Use glib portable macros to convert gpointer to int
[babeltrace.git] / types / struct.c
index 7eaa42426054b9a617c551da6fcc38006bcee7e7..e2f6a1e11912308deb6622d2c84f5a67b2152b3b 100644 (file)
@@ -196,8 +196,8 @@ void bt_struct_declaration_add_field(struct declaration_struct *struct_declarati
        field->declaration = field_declaration;
        /* Keep index in hash rather than pointer, because array can relocate */
        g_hash_table_insert(struct_declaration->fields_by_name,
        field->declaration = field_declaration;
        /* Keep index in hash rather than pointer, because array can relocate */
        g_hash_table_insert(struct_declaration->fields_by_name,
-                           (gpointer) (unsigned long) field->name,
-                           (gpointer) index);
+                           GUINT_TO_POINTER(field->name),
+                           GUINT_TO_POINTER(index));
        /*
         * Alignment of structure is the max alignment of declarations contained
         * therein.
        /*
         * Alignment of structure is the max alignment of declarations contained
         * therein.
@@ -219,11 +219,11 @@ int bt_struct_declaration_lookup_field_index(struct declaration_struct *struct_d
        gboolean found;
 
        found = g_hash_table_lookup_extended(struct_declaration->fields_by_name,
        gboolean found;
 
        found = g_hash_table_lookup_extended(struct_declaration->fields_by_name,
-                                   (gconstpointer) (unsigned long) field_name,
+                                   (gconstpointer) GUINT_TO_POINTER(field_name),
                                    NULL, &index);
        if (!found)
                return -1;
                                    NULL, &index);
        if (!found)
                return -1;
-       return (int) (unsigned long) index;
+       return GPOINTER_TO_INT(index);
 }
 
 /*
 }
 
 /*
This page took 0.023098 seconds and 4 git commands to generate.