Fix: Use of functions not provided by glib 2.22
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 11 Nov 2013 16:16:41 +0000 (11:16 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 12 Nov 2013 19:34:41 +0000 (14:34 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/writer/event-fields.c
formats/ctf/writer/event-types.c
formats/ctf/writer/writer.c

index aa389fd223051ca604b1ec49b6917cbfb2eda1b4..30fe5783db6e86a696b9ef96321ef9f233a7767b 100644 (file)
@@ -247,13 +247,14 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field,
                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;
@@ -768,12 +769,13 @@ struct bt_ctf_field *bt_ctf_field_array_create(struct bt_ctf_field_type *type)
 
        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:
index 091b3209eff8261d4526de6042ce08f8b933086e..fa4e71314a7dc213b6cd15e01ddde04c701e17ad 100644 (file)
@@ -214,8 +214,8 @@ int add_structure_field(GPtrArray *fields,
        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;
        }
index 5600a92a0a1debd22cfed2066edf5ee16bfae825..a3ca263adeca7a9eb934ea6dd74432262e7e02b9 100644 (file)
@@ -560,8 +560,9 @@ int validate_identifier(const char *input_string)
 
        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;
                }
@@ -737,8 +738,10 @@ void writer_init(void)
 
        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;
This page took 0.02684 seconds and 4 git commands to generate.