bt_ctf_field_put(sequence->length);
}
- sequence->elements = g_ptr_array_new_full((size_t)sequence_length,
- (GDestroyNotify)bt_ctf_field_put);
+ sequence->elements = g_ptr_array_sized_new((size_t)sequence_length);
if (!sequence->elements) {
ret = -1;
goto end;
}
+ g_ptr_array_set_free_func(sequence->elements,
+ (GDestroyNotify)bt_ctf_field_put);
g_ptr_array_set_size(sequence->elements, (size_t)sequence_length);
bt_ctf_field_get(length_field);
sequence->length = length_field;
array_type = container_of(type, struct bt_ctf_field_type_array, parent);
array_length = array_type->length;
- array->elements = g_ptr_array_new_full(array_length,
- (GDestroyNotify)bt_ctf_field_put);
+ array->elements = g_ptr_array_sized_new(array_length);
if (!array->elements) {
goto error;
}
+ g_ptr_array_set_free_func(array->elements,
+ (GDestroyNotify)bt_ctf_field_put);
g_ptr_array_set_size(array->elements, array_length);
return &array->parent;
error:
struct structure_field *field;
/* Make sure structure does not contain a field of the same name */
- if (g_hash_table_contains(field_name_to_index,
- GUINT_TO_POINTER(name_quark))) {
+ if (g_hash_table_lookup_extended(field_name_to_index,
+ GUINT_TO_POINTER(name_quark), NULL, NULL)) {
ret = -1;
goto end;
}
token = strtok_r(string, " ", &save_ptr);
while (token) {
- if (g_hash_table_contains(reserved_keywords_set,
- GINT_TO_POINTER(g_quark_from_string(token)))) {
+ if (g_hash_table_lookup_extended(reserved_keywords_set,
+ GINT_TO_POINTER(g_quark_from_string(token)),
+ NULL, NULL)) {
ret = -1;
goto end;
}
reserved_keywords_set = g_hash_table_new(g_direct_hash, g_direct_equal);
for (i = 0; i < reserved_keywords_count; i++) {
- g_hash_table_add(reserved_keywords_set,
- GINT_TO_POINTER(g_quark_from_string(reserved_keywords_str[i])));
+ gpointer quark = GINT_TO_POINTER(g_quark_from_string(
+ reserved_keywords_str[i]));
+
+ g_hash_table_insert(reserved_keywords_set, quark, quark);
}
init_done = 1;