X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=types%2Fstruct.c;h=cf8fef6bd6812306d69985dc43efe26194c7deeb;hp=188be82cadb95592864162cd47f8b8fcd5c21f48;hb=ebdb2383272428704cfbb8662f567159f3697cad;hpb=64fa3fec6c28f1d077812b4bfa06ae73b0f5999d diff --git a/types/struct.c b/types/struct.c index 188be82c..cf8fef6b 100644 --- a/types/struct.c +++ b/types/struct.c @@ -16,10 +16,19 @@ * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ #include #include +#include #include #ifndef max @@ -65,7 +74,7 @@ void _struct_declaration_free(struct declaration *declaration) struct declaration_field *declaration_field = &g_array_index(struct_declaration->fields, struct declaration_field, i); - declaration_unref(declaration_field->declaration); + bt_declaration_unref(declaration_field->declaration); } g_array_free(struct_declaration->fields, true); g_free(struct_declaration); @@ -109,7 +118,7 @@ struct definition * int ret; _struct = g_new(struct definition_struct, 1); - declaration_ref(&struct_declaration->p); + bt_declaration_ref(&struct_declaration->p); _struct->p.declaration = declaration; _struct->declaration = struct_declaration; _struct->p.ref = 1; @@ -146,10 +155,10 @@ struct definition * error: for (i--; i >= 0; i--) { struct definition *field = g_ptr_array_index(_struct->fields, i); - definition_unref(field); + bt_definition_unref(field); } free_definition_scope(_struct->p.scope); - declaration_unref(&struct_declaration->p); + bt_declaration_unref(&struct_declaration->p); g_free(_struct); return NULL; } @@ -164,10 +173,11 @@ void _struct_definition_free(struct definition *definition) assert(_struct->fields->len == _struct->declaration->fields->len); for (i = 0; i < _struct->fields->len; i++) { struct definition *field = g_ptr_array_index(_struct->fields, i); - definition_unref(field); + bt_definition_unref(field); } free_definition_scope(_struct->p.scope); - declaration_unref(_struct->p.declaration); + bt_declaration_unref(_struct->p.declaration); + g_ptr_array_free(_struct->fields, TRUE); g_free(_struct); } @@ -182,7 +192,7 @@ void struct_declaration_add_field(struct declaration_struct *struct_declaration, index = struct_declaration->fields->len - 1; /* last field (new) */ field = &g_array_index(struct_declaration->fields, struct declaration_field, index); field->name = g_quark_from_string(field_name); - declaration_ref(field_declaration); + bt_declaration_ref(field_declaration); field->declaration = field_declaration; /* Keep index in hash rather than pointer, because array can relocate */ g_hash_table_insert(struct_declaration->fields_by_name,