Use glib portable macros to convert gpointer to int
A message that is not in the archive (sent off-list or not yet received): [email protected]
As long as those macros exist in glib 2.22+, I'm ok with this change.
Thanks,
Mathieu
Quoted 576 lines · ----- On Sep 14, 2016, at 8:52 PM, Michael Jeanson [email protected] wrote:
---
formats/ctf-text/ctf-text.c | 2 +- formats/ctf/callbacks.c | 4 ++-- formats/ctf/events.c | 2 +- formats/ctf/ir/field-types.c | 4 ++-- formats/ctf/metadata/ctf-parser.y | 2 +- .../ctf/metadata/ctf-visitor-generate-io-struct.c | 12 ++++++------ lib/context.c | 4 ++-- lib/registry.c | 8 ++++---- lib/trace-collection.c | 8 ++++---- lib/trace-handle.c | 6 +++--- lib/values.c | 6 +++--- types/enum.c | 10 +++++----- types/struct.c | 8 ++++---- types/types.c | 20 ++++++++++---------- types/variant.c | 12 ++++++------ 15 files changed, 54 insertions(+), 54 deletions(-)formats/ctf-text/ctf-text.c +1
-1@@ -136,7 +136,7 @@ struct ctf_callsite_dups *ctf_trace_callsite_lookup(struct ctf_trace *trace, GQuark callsite_name) {return g_hash_table_lookup (trace->callsites, - (gpointer ) (unsigned long ) callsite_name); +GUINT_TO_POINTER (callsite_name)); }void
bt_ctf_text_hook(void)formats/ctf/callbacks.c +2
-2@@ -115,13 +115,13 @@ int bt_ctf_iter_add_callback(struct bt_ctf_iter *iter,if (event) {/* find the event id */ event_id_ptr =g_hash_table_lookup (stream->event_quark_to_id, - (gconstpointer ) (unsigned long ) event); + (gconstpointer )GUINT_TO_POINTER (event));/* event not found in this stream class */ if (!event_id_ptr) {fprintf (stderr,"[error] Event ID not found in stream class\n" );continue ; } - event_id = (uint64_t )(unsigned long ) *event_id_ptr; + event_id =GPOINTER_TO_UINT (*event_id_ptr);/* find or create the bt_callback_chain for this event */ if (event_id >= bt_stream_cb->per_id_callbacks->len) {formats/ctf/events.c +1
-1@@ -690,7 +690,7 @@ int bt_ctf_get_event_decl_list(int handle_id, structbt_context *ctx, goto error; handle =g_hash_table_lookup (ctx->trace_handles, - (gpointer ) (unsigned long ) handle_id); +GUINT_TO_POINTER (handle_id));if (!handle) goto error;formats/ctf/ir/field-types.c +2
-2@@ -404,8 +404,8 @@ int add_structure_field(GPtrArray *fields, field->name = name_quark; field->type = field_type;g_hash_table_insert (field_name_to_index, - (gpointer ) (unsigned long ) name_quark, - (gpointer ) (unsigned long ) fields->len); +GUINT_TO_POINTER (name_quark), +GUINT_TO_POINTER (fields->len));g_ptr_array_add (fields, field);end:
return ret;formats/ctf/metadata/ctf-parser.y +1
-1@@ -330,7 +330,7 @@ static int lookup_type(struct ctf_scanner_scope *s, const char *id) { int ret; - ret = (int) (long) g_hash_table_lookup(s->types, id); + ret = GPOINTER_TO_INT(g_hash_table_lookup(s->types, id)); printf_debug("lookup %p %s %d\n", s, id, ret); return ret;}
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +0
-0@@ -278,7 +278,7 @@ struct ctf_event_declaration *stream_event_lookup(struct
ctf_stream_declaration
static
structctf_clock*trace_clock_lookup(structctf_trace*trace, GQuarkclock_name) {formats/ctf/metadata/ctf-visitor-generate-io-struct.c +0
-1- return g_hash_table_lookup(trace->parent.clocks, (gpointer) (unsigned long)
clock_name);formats/ctf/metadata/ctf-visitor-generate-io-struct.c +1
-0+ return g_hash_table_lookup(trace->parent.clocks,
GUINT_TO_POINTER(clock_name));
}static
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +1
-1@@ -1907,7 +1907,7 @@ int ctf_event_visit(FILE *fd, int depth, struct ctf_node *node,g_ptr_array_set_size (event->stream->events_by_id, event->id +1 );g_ptr_array_index (event->stream->events_by_id, event->id) = event;g_hash_table_insert (event->stream->event_quark_to_id, - (gpointer ) (unsigned long ) event->name, +GUINT_TO_POINTER (event->name), &event->id);g_ptr_array_add (trace->event_declarations, event_decl);return 0;formats/ctf/metadata/ctf-visitor-generate-io-struct.c +1
-1@@ -2491,7 +2491,7 @@ int ctf_clock_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_trace goto error; } trace->parent.single_clock = clock; -g_hash_table_insert (trace->parent.clocks, (gpointer ) (unsigned long ) clock->name, clock); +g_hash_table_insert (trace->parent.clocks,GUINT_TO_POINTER (clock->name), clock);return 0;error:
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +1
-1@@ -2526,7 +2526,7 @@ void ctf_clock_default(FILE *fd, int depth, struct ctf_trace *trace) } trace->parent.single_clock = clock; -g_hash_table_insert (trace->parent.clocks, (gpointer ) (unsigned long ) clock->name, clock); +g_hash_table_insert (trace->parent.clocks,GUINT_TO_POINTER (clock->name), clock);}
static
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +0
-0@@ -2683,12 +2683,12 @@ int ctf_callsite_visit(FILE *fd, int depth, struct
ctf_node*node, structctf_tr} cs_dups = g_hash_table_lookup(trace->callsites,formats/ctf/metadata/ctf-visitor-generate-io-struct.c +1
-1- (gpointer) (unsigned long) callsite->name); + GUINT_TO_POINTER(callsite->name));if (!cs_dups) { cs_dups = g_new0(struct ctf_callsite_dups, 1); BT_INIT_LIST_HEAD(&cs_dups->head); g_hash_table_insert(trace->callsites,formats/ctf/metadata/ctf-visitor-generate-io-struct.c +1
-1- (gpointer) (unsigned long) callsite->name, cs_dups); + GUINT_TO_POINTER(callsite->name), cs_dups);} bt_list_add_tail(&callsite->node, &cs_dups->head); return 0;lib/context.c +1
-1@@ -174,7 +174,7 @@ int bt_context_add_trace(struct bt_context *ctx, const char *path,/* Add new handle to container */ g_hash_table_insert (ctx->trace_handles, - (gpointer ) (unsigned long ) handle->id, +GUINT_TO_POINTER (handle->id), handle);return handle->id;lib/context.c +1
-1@@ -207,7 +207,7 @@ int bt_context_remove_trace(struct bt_context *ctx, inthandle_id) * automatically. */ if (!g_hash_table_remove (ctx->trace_handles, - (gpointer ) (unsigned long ) handle_id)) { +GUINT_TO_POINTER (handle_id))) { ret = -ENOENT ; goto end;}lib/registry.c +4
-4@@ -73,7 +73,7 @@ struct bt_format *bt_lookup_format(bt_intern_str name)return NULL ;return g_hash_table_lookup (format_registry, - (gconstpointer ) (unsigned long ) name); + (gconstpointer )GUINT_TO_POINTER (name)); }static void show_format (gpointer key,gpointer value,gpointer user_data)@@ -81,7 +81,7 @@ static void show_format(gpointer key, gpointer value, gpointer user_data)struct walk_data *data = user_data;fprintf (data->fp,"%s%s" , data->iter ?", " :"" , -g_quark_to_string ((GQuark ) (unsigned long ) key)); +g_quark_to_string ((GQuark )GPOINTER_TO_UINT (key))); data->iter++; }@@ -116,7 +116,7 @@ int bt_register_format(struct bt_format *format)format_refcount_inc ();g_hash_table_insert (format_registry, - (gpointer ) (unsigned long ) format->name, +GUINT_TO_POINTER (format->name), format);return 0 ; }@@ -125,7 +125,7 @@ void bt_unregister_format(struct bt_format *format) {assert (bt_lookup_format (format->name));g_hash_table_remove (format_registry, - (gpointer ) (unsigned long ) format->name); +GUINT_TO_POINTER (format->name));format_refcount_dec (); }lib/trace-collection.c +1
-1@@ -53,7 +53,7 @@ static void check_clock_match(gpointer key, gpointer value,gpointer user_data) * by clock name. */ clock_b =g_hash_table_lookup (match->clocks, - (gpointer ) (unsigned long ) clock_a->name); +GUINT_TO_POINTER (clock_a->name));if (clock_b) { match->clock_match = clock_b;return;lib/trace-collection.c +1
-1@@ -64,7 +64,7 @@ static void check_clock_match(gpointer key, gpointer value,gpointer user_data) * clocks. */ clock_b =g_hash_table_lookup (match->clocks, - (gpointer ) (unsigned long ) clock_a->uuid); +GUINT_TO_POINTER (clock_a->uuid));if (clock_b) { match->clock_match = clock_b;return;lib/trace-collection.c +1
-1@@ -87,7 +87,7 @@ static void clock_add(gpointer key, gpointer value, gpointer user_data)struct ctf_clock *tc_clock; tc_clock =g_hash_table_lookup (tc_clocks, - (gpointer ) (unsigned long ) v); +GUINT_TO_POINTER (v));if (!tc_clock) {/* * For now we only support CTF that has one
lib/trace-collection.c +1
-1@@ -105,7 +105,7 @@ static void clock_add(gpointer key, gpointer value, gpointer user_data) clock_match->tc->offset_first; }g_hash_table_insert (tc_clocks, - (gpointer ) (unsigned long ) v, +GUINT_TO_POINTER (v), value); }else if (!t_clock->absolute) {int64_t diff_ns;lib/trace-handle.c +1
-1@@ -60,7 +60,7 @@ const char *bt_trace_handle_get_path(struct bt_context *ctx, int handle_id)return NULL ; handle =g_hash_table_lookup (ctx->trace_handles, - (gpointer ) (unsigned long ) handle_id); +GUINT_TO_POINTER (handle_id));if (!handle)return NULL ;return handle->path;lib/trace-handle.c +1
-1@@ -77,7 +77,7 @@ int bt_trace_handle_get_timestamp_begin(struct bt_context *ctx, return -1 ; handle =g_hash_table_lookup (ctx->trace_handles, - (gpointer ) (unsigned long ) handle_id); +GUINT_TO_POINTER (handle_id));if (!handle) { ret =-1 ;goto end;lib/trace-handle.c +1
-1@@ -105,7 +105,7 @@ int bt_trace_handle_get_timestamp_end(struct bt_context *ctx, return -1 ; handle =g_hash_table_lookup (ctx->trace_handles, - (gpointer ) (unsigned long ) handle_id); +GUINT_TO_POINTER (handle_id));if (!handle) { ret =-1 ;goto end;lib/values.c +3
-3@@ -226,7 +226,7 @@ struct bt_value *bt_value_map_copy(const struct bt_value *map_obj)g_hash_table_iter_init (&iter, typed_map_obj->ght);while (g_hash_table_iter_next (&iter, &key, &element_obj)) { -const char *key_str =g_quark_to_string ((unsigned long ) key); +const char *key_str =g_quark_to_string (GPOINTER_TO_UINT (key)); element_obj_copy =bt_value_copy (element_obj);@@ -357,7 +357,7 @@ bool bt_value_map_compare(const struct bt_value *object_a,while (g_hash_table_iter_next (&iter, &key, &element_obj_a)) {struct bt_value *element_obj_b; -const char *key_str =g_quark_to_string ((unsigned long ) key); +const char *key_str =g_quark_to_string (GPOINTER_TO_UINT (key)); element_obj_b =bt_value_map_get (object_b, key_str);@@ -1156,7 +1156,7 @@ enum bt_value_status bt_value_map_foreach(const struct bt_value *map_obj,g_hash_table_iter_init (&iter, typed_map_obj->ght);while (g_hash_table_iter_next (&iter, &key, &element_obj)) { -const char *key_str =g_quark_to_string ((unsigned long ) key); +const char *key_str =g_quark_to_string (GPOINTER_TO_UINT (key));if (!cb (key_str, element_obj, data)) {ret = BT_VALUE_STATUS_CANCELLED;types/enum.c +0
-0@@ -270,7 +270,7 @@ GArray *bt_enum_quark_to_range_set(const struct
declaration_enum*enum_declarati
GQuark q){ return g_hash_table_lookup(enum_declaration->table.quark_to_range_set,types/enum.c +1
-1- (gconstpointer) (unsigned long) q); + (gconstpointer) GUINT_TO_POINTER(q));}
static
types/enum.c +2
-2@@ -319,12 +319,12 @@ void bt_enum_signed_insert(struct declaration_enum *enum_declaration, } array =g_hash_table_lookup (enum_declaration->table.quark_to_range_set, - (gconstpointer ) (unsigned long ) q); + (gconstpointer )GUINT_TO_POINTER (q));if (!array) { array =g_array_sized_new (FALSE, TRUE,sizeof (struct enum_range ),1 );g_hash_table_insert (enum_declaration->table.quark_to_range_set, - (gpointer ) (unsigned long ) q, +GUINT_TO_POINTER (q), array); }g_array_set_size(array, array->len + 1);types/enum.c +2
-2@@ -354,12 +354,12 @@ void bt_enum_unsigned_insert(struct declaration_enum *enum_declaration, } array =g_hash_table_lookup (enum_declaration->table.quark_to_range_set, - (gconstpointer ) (unsigned long ) q); + (gconstpointer )GUINT_TO_POINTER (q));if (!array) { array =g_array_sized_new (FALSE, TRUE,sizeof (struct enum_range ),1 );g_hash_table_insert (enum_declaration->table.quark_to_range_set, - (gpointer ) (unsigned long ) q, +GUINT_TO_POINTER (q), array); }g_array_set_size(array, array->len + 1);types/struct.c +0
-0@@ -196,8 +196,8 @@ void bt_struct_declaration_add_field(struct
declaration_struct*struct_declaratifield->declaration = field_declaration; /* Keep index in hash rather than pointer, because array can relocate */ g_hash_table_insert(struct_declaration->fields_by_name,types/struct.c +2
-2- (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.types/struct.c +0
-0@@ -219,11 +219,11 @@ int bt_struct_declaration_lookup_field_index(struct
declaration_struct*struct_dgboolean found; found = g_hash_table_lookup_extended(struct_declaration->fields_by_name,types/struct.c +1
-1- (gconstpointer) (unsigned long) field_name, + (gconstpointer) GUINT_TO_POINTER(field_name),NULL, &index); if (!found) return -1;types/struct.c +1
-1-return (int ) (unsigned long ) index; +return GPOINTER_TO_INT (index);}
/*
types/types.c +2
-2@@ -56,7 +56,7 @@ struct bt_declaration * struct declaration_scope *scope) {return g_hash_table_lookup (scope->typedef_declarations, - (gconstpointer ) (unsigned long ) declaration_name); + (gconstpointer )GUINT_TO_POINTER (declaration_name)); } struct bt_declaration *bt_lookup_declaration(GQuark declaration_name,@@ -85,7 +85,7 @@ int bt_register_declaration(GQuark name, struct bt_declaration *declaration, return -EEXIST ;g_hash_table_insert (scope->typedef_declarations, - (gpointer ) (unsigned long ) name, +GUINT_TO_POINTER (name), declaration);bt_declaration_ref (declaration);return 0;types/types.c +1
-1@@ -97,7 +97,7 @@ struct bt_definition * struct definition_scope *scope) {return g_hash_table_lookup (scope->definitions, - (gconstpointer ) (unsigned long ) field_name); + (gconstpointer )GUINT_TO_POINTER (field_name)); }/* @@ -273,7 +273,7 @@ int bt_register_field_definition(GQuark field_name, struct
bt_definition*definireturn -EEXIST; g_hash_table_insert(scope->definitions,types/types.c +1
-1- (gpointer) (unsigned long) field_name, + GUINT_TO_POINTER(field_name),definition); /* Don't keep reference on definition */ return 0;types/types.c +1
-1@@ -340,7 +340,7 @@ struct declaration_struct *bt_lookup_struct_declaration_scope(GQuark struct_name struct declaration_scope *scope) {return g_hash_table_lookup (scope->struct_declarations, - (gconstpointer ) (unsigned long ) struct_name); + (gconstpointer )GUINT_TO_POINTER (struct_name)); }struct
declaration_struct*bt_lookup_struct_declaration(GQuarkstruct_name,types/types.c +2
-2@@ -372,7 +372,7 @@ int bt_register_struct_declaration(GQuark struct_name,return -EEXIST ;g_hash_table_insert (scope->struct_declarations, - (gpointer ) (unsigned long ) struct_name, +GUINT_TO_POINTER (struct_name), struct_declaration);bt_declaration_ref (&struct_declaration->p);@@ -389,7 +389,7 @@ struct declaration_untagged_variant * struct declaration_scope *scope) {return g_hash_table_lookup (scope->variant_declarations, - (gconstpointer ) (unsigned long ) variant_name); + (gconstpointer )GUINT_TO_POINTER (variant_name)); }struct
declaration_untagged_variant*types/types.c +2
-2@@ -422,7 +422,7 @@ int bt_register_variant_declaration(GQuark variant_name,return -EEXIST ;g_hash_table_insert (scope->variant_declarations, - (gpointer ) (unsigned long ) variant_name, +GUINT_TO_POINTER (variant_name), untagged_variant_declaration);bt_declaration_ref (&untagged_variant_declaration->p);@@ -440,7 +440,7 @@ struct declaration_enum * struct declaration_scope *scope) {return g_hash_table_lookup (scope->enum_declarations, - (gconstpointer ) (unsigned long ) enum_name); + (gconstpointer )GUINT_TO_POINTER (enum_name)); }struct
declaration_enum*types/types.c +1
-1@@ -473,7 +473,7 @@ int bt_register_enum_declaration(GQuark enum_name,return -EEXIST ;g_hash_table_insert (scope->enum_declarations, - (gpointer ) (unsigned long ) enum_name, +GUINT_TO_POINTER (enum_name), enum_declaration);bt_declaration_ref (&enum_declaration->p);types/variant.c +0
-0@@ -227,8 +227,8 @@ void bt_untagged_variant_declaration_add_field(struct
declaration_untagged_variafield->declaration = field_declaration; /* Keep index in hash rather than pointer, because array can relocate */ g_hash_table_insert(untagged_variant_declaration->fields_by_tag,types/variant.c +2
-2- (gpointer ) (unsigned long ) field->name, - (gpointer) index); +GUINT_TO_POINTER (field->name), + GUINT_TO_POINTER(index));/*
* Alignment of variant is based on the alignment of its currently
* selected choice, so we leave variant alignment as-is (staticallytypes/variant.c +0
-0@@ -244,13 +244,13 @@ bt_untagged_variant_declaration_get_field_from_tag(struct
declaration_untagged_vfound = g_hash_table_lookup_extended( untagged_variant_declaration->fields_by_tag,types/variant.c +1
-1- (gconstpointer) (unsigned long) tag, NULL, &index); + (gconstpointer) GUINT_TO_POINTER(tag), NULL, &index);if (!found) { return NULL; }types/variant.c +0
-1- return &g_array_index(untagged_variant_declaration->fields, struct
declaration_field, (unsigned long)index);types/variant.c +1
-0+ return &g_array_index(untagged_variant_declaration->fields, struct
declaration_field,GPOINTER_TO_UINT(index));
}/*
types/variant.c +0
-0@@ -279,7 +279,7 @@ struct bt_definition *bt_variant_get_current_field(struct
definition_variant*vaassert(tag_array->len == 1); tag = g_array_index(tag_array, GQuark, 0); if (!g_hash_table_lookup_extended(variant_declaration->untagged_variant->fields_by_tag,types/variant.c +1
-1- (gconstpointer) (unsigned long) tag, + (gconstpointer) GUINT_TO_POINTER(tag),&orig_key, &value)) { /* Cannot find matching field. */types/variant.c +0
-0@@ -287,7 +287,7 @@ struct bt_definition *bt_variant_get_current_field(struct
definition_variant*vag_quark_to_string(tag)); return NULL; }types/variant.c +1
-1- index = (unsigned long ) value; + index =GPOINTER_TO_UINT (value);variant->current_field = g_ptr_array_index(variant->fields, index); return variant->current_field; }--
2.7.4_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 7 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Mathieu Desnoyers
As long as those macros exist in glib 2.22+, I'm ok with this change.
Thanks,
Mathieu
Yes they do.
Michael
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Merged in master, thanks!
Jérémie
Quoted 529 lines · Michael Jeanson
--- formats/ctf-text/ctf-text.c | 2 +- formats/ctf/callbacks.c | 4 ++-- formats/ctf/events.c | 2 +- formats/ctf/ir/field-types.c | 4 ++-- formats/ctf/metadata/ctf-parser.y | 2 +- .../ctf/metadata/ctf-visitor-generate-io-struct.c | 12 ++++++------ lib/context.c | 4 ++-- lib/registry.c | 8 ++++---- lib/trace-collection.c | 8 ++++---- lib/trace-handle.c | 6 +++--- lib/values.c | 6 +++--- types/enum.c | 10 +++++----- types/struct.c | 8 ++++---- types/types.c | 20 ++++++++++---------- types/variant.c | 12 ++++++------ 15 files changed, 54 insertions(+), 54 deletions(-)formats/ctf-text/ctf-text.c +1
-1@@ -136,7 +136,7 @@ struct ctf_callsite_dups *ctf_trace_callsite_lookup(struct ctf_trace *trace, GQuark callsite_name) {return g_hash_table_lookup (trace->callsites, - (gpointer ) (unsigned long ) callsite_name); +GUINT_TO_POINTER (callsite_name)); }void bt_ctf_text_hook (void )formats/ctf/callbacks.c +2
-2@@ -115,13 +115,13 @@ int bt_ctf_iter_add_callback(struct bt_ctf_iter *iter,if (event) {/* find the event id */ event_id_ptr =g_hash_table_lookup (stream->event_quark_to_id, - (gconstpointer ) (unsigned long ) event); + (gconstpointer )GUINT_TO_POINTER (event));/* event not found in this stream class */ if (!event_id_ptr) {fprintf (stderr,"[error] Event ID not found in stream class\n" );continue ; } - event_id = (uint64_t )(unsigned long ) *event_id_ptr; + event_id =GPOINTER_TO_UINT (*event_id_ptr);/* find or create the bt_callback_chain for this event */ if (event_id >= bt_stream_cb->per_id_callbacks->len) {formats/ctf/events.c +1
-1@@ -690,7 +690,7 @@ int bt_ctf_get_event_decl_list(int handle_id, struct bt_context *ctx, goto error; handle =g_hash_table_lookup (ctx->trace_handles, - (gpointer ) (unsigned long ) handle_id); +GUINT_TO_POINTER (handle_id));if (!handle) goto error;formats/ctf/ir/field-types.c +2
-2@@ -404,8 +404,8 @@ int add_structure_field(GPtrArray *fields, field->name = name_quark; field->type = field_type;g_hash_table_insert (field_name_to_index, - (gpointer ) (unsigned long ) name_quark, - (gpointer ) (unsigned long ) fields->len); +GUINT_TO_POINTER (name_quark), +GUINT_TO_POINTER (fields->len));g_ptr_array_add (fields, field); end:return ret;formats/ctf/metadata/ctf-parser.y +1
-1@@ -330,7 +330,7 @@ static int lookup_type(struct ctf_scanner_scope *s, const char *id) { int ret; - ret = (int) (long) g_hash_table_lookup(s->types, id); + ret = GPOINTER_TO_INT(g_hash_table_lookup(s->types, id)); printf_debug("lookup %p %s %d\n", s, id, ret); return ret; }formats/ctf/metadata/ctf-visitor-generate-io-struct.c +6
-6@@ -278,7 +278,7 @@ struct ctf_event_declaration *stream_event_lookup(struct ctf_stream_declarationstatic struct ctf_clock *trace_clock_lookup (struct ctf_trace *trace,GQuark clock_name) { -return g_hash_table_lookup (trace->parent.clocks, (gpointer ) (unsigned long ) clock_name); +return g_hash_table_lookup (trace->parent.clocks,GUINT_TO_POINTER (clock_name)); } static@@ -1907,7 +1907,7 @@ int ctf_event_visit(FILE *fd, int depth, struct ctf_node *node,g_ptr_array_set_size (event->stream->events_by_id, event->id +1 );g_ptr_array_index (event->stream->events_by_id, event->id) = event;g_hash_table_insert (event->stream->event_quark_to_id, - (gpointer ) (unsigned long ) event->name, +GUINT_TO_POINTER (event->name), &event->id);g_ptr_array_add (trace->event_declarations, event_decl);return 0 ;@@ -2491,7 +2491,7 @@ int ctf_clock_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_trace goto error; } trace->parent.single_clock = clock; -g_hash_table_insert (trace->parent.clocks, (gpointer ) (unsigned long ) clock->name, clock); +g_hash_table_insert (trace->parent.clocks,GUINT_TO_POINTER (clock->name), clock);return 0 ; error:@@ -2526,7 +2526,7 @@ void ctf_clock_default(FILE *fd, int depth, struct ctf_trace *trace) } trace->parent.single_clock = clock; -g_hash_table_insert (trace->parent.clocks, (gpointer ) (unsigned long ) clock->name, clock); +g_hash_table_insert (trace->parent.clocks,GUINT_TO_POINTER (clock->name), clock); } static@@ -2683,12 +2683,12 @@ int ctf_callsite_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_tr } cs_dups =g_hash_table_lookup (trace->callsites, - (gpointer ) (unsigned long ) callsite->name); +GUINT_TO_POINTER (callsite->name));if (!cs_dups) { cs_dups = g_new0(struct ctf_callsite_dups, 1);BT_INIT_LIST_HEAD (&cs_dups->head);g_hash_table_insert (trace->callsites, - (gpointer ) (unsigned long ) callsite->name, cs_dups); +GUINT_TO_POINTER (callsite->name), cs_dups); }bt_list_add_tail (&callsite->node, &cs_dups->head);return 0 ;lib/context.c +2
-2@@ -174,7 +174,7 @@ int bt_context_add_trace(struct bt_context *ctx, const char *path,/* Add new handle to container */ g_hash_table_insert (ctx->trace_handles, - (gpointer ) (unsigned long ) handle->id, +GUINT_TO_POINTER (handle->id), handle);return handle->id;@@ -207,7 +207,7 @@ int bt_context_remove_trace(struct bt_context *ctx, int handle_id)* automatically. */ if (!g_hash_table_remove (ctx->trace_handles, - (gpointer ) (unsigned long ) handle_id)) { +GUINT_TO_POINTER (handle_id))) { ret = -ENOENT ; goto end; }lib/registry.c +4
-4@@ -73,7 +73,7 @@ struct bt_format *bt_lookup_format(bt_intern_str name)return NULL ;return g_hash_table_lookup (format_registry, - (gconstpointer ) (unsigned long ) name); + (gconstpointer )GUINT_TO_POINTER (name)); }static void show_format (gpointer key,gpointer value,gpointer user_data)@@ -81,7 +81,7 @@ static void show_format(gpointer key, gpointer value, gpointer user_data)struct walk_data *data = user_data;fprintf (data->fp,"%s%s" , data->iter ?", " :"" , -g_quark_to_string ((GQuark ) (unsigned long ) key)); +g_quark_to_string ((GQuark )GPOINTER_TO_UINT (key))); data->iter++; }@@ -116,7 +116,7 @@ int bt_register_format(struct bt_format *format)format_refcount_inc ();g_hash_table_insert (format_registry, - (gpointer ) (unsigned long ) format->name, +GUINT_TO_POINTER (format->name), format);return 0 ; }@@ -125,7 +125,7 @@ void bt_unregister_format(struct bt_format *format) {assert (bt_lookup_format (format->name));g_hash_table_remove (format_registry, - (gpointer ) (unsigned long ) format->name); +GUINT_TO_POINTER (format->name));format_refcount_dec (); }lib/trace-collection.c +4
-4@@ -53,7 +53,7 @@ static void check_clock_match(gpointer key, gpointer value, gpointer user_data)* by clock name. */ clock_b =g_hash_table_lookup (match->clocks, - (gpointer ) (unsigned long ) clock_a->name); +GUINT_TO_POINTER (clock_a->name));if (clock_b) { match->clock_match = clock_b;return ;@@ -64,7 +64,7 @@ static void check_clock_match(gpointer key, gpointer value, gpointer user_data)* clocks. */ clock_b =g_hash_table_lookup (match->clocks, - (gpointer ) (unsigned long ) clock_a->uuid); +GUINT_TO_POINTER (clock_a->uuid));if (clock_b) { match->clock_match = clock_b;return ;@@ -87,7 +87,7 @@ static void clock_add(gpointer key, gpointer value, gpointer user_data)struct ctf_clock *tc_clock; tc_clock =g_hash_table_lookup (tc_clocks, - (gpointer ) (unsigned long ) v); +GUINT_TO_POINTER (v));if (!tc_clock) {/* * For now we only support CTF that has one @@ -105,7 +105,7 @@ static void clock_add(gpointer key, gpointer value, gpointer user_data) clock_match->tc->offset_first; }g_hash_table_insert (tc_clocks, - (gpointer ) (unsigned long ) v, +GUINT_TO_POINTER (v), value); }else if (!t_clock->absolute) {int64_t diff_ns;lib/trace-handle.c +3
-3@@ -60,7 +60,7 @@ const char *bt_trace_handle_get_path(struct bt_context *ctx, int handle_id)return NULL ; handle =g_hash_table_lookup (ctx->trace_handles, - (gpointer ) (unsigned long ) handle_id); +GUINT_TO_POINTER (handle_id));if (!handle)return NULL ;return handle->path;@@ -77,7 +77,7 @@ int bt_trace_handle_get_timestamp_begin(struct bt_context *ctx,return -1 ; handle =g_hash_table_lookup (ctx->trace_handles, - (gpointer ) (unsigned long ) handle_id); +GUINT_TO_POINTER (handle_id));if (!handle) { ret =-1 ; goto end;@@ -105,7 +105,7 @@ int bt_trace_handle_get_timestamp_end(struct bt_context *ctx,return -1 ; handle =g_hash_table_lookup (ctx->trace_handles, - (gpointer ) (unsigned long ) handle_id); +GUINT_TO_POINTER (handle_id));if (!handle) { ret =-1 ; goto end;lib/values.c +3
-3@@ -226,7 +226,7 @@ struct bt_value *bt_value_map_copy(const struct bt_value *map_obj)g_hash_table_iter_init (&iter, typed_map_obj->ght);while (g_hash_table_iter_next (&iter, &key, &element_obj)) { -const char *key_str =g_quark_to_string ((unsigned long ) key); +const char *key_str =g_quark_to_string (GPOINTER_TO_UINT (key)); element_obj_copy =bt_value_copy (element_obj);@@ -357,7 +357,7 @@ bool bt_value_map_compare(const struct bt_value *object_a,while (g_hash_table_iter_next (&iter, &key, &element_obj_a)) {struct bt_value *element_obj_b; -const char *key_str =g_quark_to_string ((unsigned long ) key); +const char *key_str =g_quark_to_string (GPOINTER_TO_UINT (key)); element_obj_b =bt_value_map_get (object_b, key_str);@@ -1156,7 +1156,7 @@ enum bt_value_status bt_value_map_foreach(const struct bt_value *map_obj,g_hash_table_iter_init (&iter, typed_map_obj->ght);while (g_hash_table_iter_next (&iter, &key, &element_obj)) { -const char *key_str =g_quark_to_string ((unsigned long ) key); +const char *key_str =g_quark_to_string (GPOINTER_TO_UINT (key));if (!cb (key_str, element_obj, data)) { ret =BT_VALUE_STATUS_CANCELLED ;types/enum.c +5
-5@@ -270,7 +270,7 @@ GArray *bt_enum_quark_to_range_set(const struct declaration_enum *enum_declarati GQuark q) {return g_hash_table_lookup (enum_declaration->table.quark_to_range_set, - (gconstpointer ) (unsigned long ) q); + (gconstpointer )GUINT_TO_POINTER (q)); } static@@ -319,12 +319,12 @@ void bt_enum_signed_insert(struct declaration_enum *enum_declaration, } array =g_hash_table_lookup (enum_declaration->table.quark_to_range_set, - (gconstpointer ) (unsigned long ) q); + (gconstpointer )GUINT_TO_POINTER (q));if (!array) { array =g_array_sized_new (FALSE, TRUE,sizeof (struct enum_range ),1 );g_hash_table_insert (enum_declaration->table.quark_to_range_set, - (gpointer ) (unsigned long ) q, +GUINT_TO_POINTER (q), array); }g_array_set_size (array, array->len +1 );@@ -354,12 +354,12 @@ void bt_enum_unsigned_insert(struct declaration_enum *enum_declaration, } array =g_hash_table_lookup (enum_declaration->table.quark_to_range_set, - (gconstpointer ) (unsigned long ) q); + (gconstpointer )GUINT_TO_POINTER (q));if (!array) { array =g_array_sized_new (FALSE, TRUE,sizeof (struct enum_range ),1 );g_hash_table_insert (enum_declaration->table.quark_to_range_set, - (gpointer ) (unsigned long ) q, +GUINT_TO_POINTER (q), array); }g_array_set_size (array, array->len +1 );types/struct.c +4
-4@@ -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, - (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. @@ -219,11 +219,11 @@ int bt_struct_declaration_lookup_field_index(struct declaration_struct *struct_dgboolean 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 ; -return (int ) (unsigned long ) index; +return GPOINTER_TO_INT (index); }/* types/types.c +10
-10@@ -56,7 +56,7 @@ struct bt_declaration * struct declaration_scope *scope) {return g_hash_table_lookup (scope->typedef_declarations, - (gconstpointer ) (unsigned long ) declaration_name); + (gconstpointer )GUINT_TO_POINTER (declaration_name)); } struct bt_declaration *bt_lookup_declaration(GQuark declaration_name,@@ -85,7 +85,7 @@ int bt_register_declaration(GQuark name, struct bt_declaration *declaration,return -EEXIST ;g_hash_table_insert (scope->typedef_declarations, - (gpointer ) (unsigned long ) name, +GUINT_TO_POINTER (name), declaration);bt_declaration_ref (declaration);return 0 ;@@ -97,7 +97,7 @@ struct bt_definition * struct definition_scope *scope) {return g_hash_table_lookup (scope->definitions, - (gconstpointer ) (unsigned long ) field_name); + (gconstpointer )GUINT_TO_POINTER (field_name)); }/* @@ -273,7 +273,7 @@ int bt_register_field_definition(GQuark field_name, struct bt_definition *definireturn -EEXIST ;g_hash_table_insert (scope->definitions, - (gpointer ) (unsigned long ) field_name, +GUINT_TO_POINTER (field_name), definition);/* Don't keep reference on definition */ return 0 ;@@ -340,7 +340,7 @@ struct declaration_struct *bt_lookup_struct_declaration_scope(GQuark struct_name struct declaration_scope *scope) {return g_hash_table_lookup (scope->struct_declarations, - (gconstpointer ) (unsigned long ) struct_name); + (gconstpointer )GUINT_TO_POINTER (struct_name)); } struct declaration_struct *bt_lookup_struct_declaration(GQuark struct_name,@@ -372,7 +372,7 @@ int bt_register_struct_declaration(GQuark struct_name,return -EEXIST ;g_hash_table_insert (scope->struct_declarations, - (gpointer ) (unsigned long ) struct_name, +GUINT_TO_POINTER (struct_name), struct_declaration);bt_declaration_ref (&struct_declaration->p);@@ -389,7 +389,7 @@ struct declaration_untagged_variant * struct declaration_scope *scope) {return g_hash_table_lookup (scope->variant_declarations, - (gconstpointer ) (unsigned long ) variant_name); + (gconstpointer )GUINT_TO_POINTER (variant_name)); } struct declaration_untagged_variant *@@ -422,7 +422,7 @@ int bt_register_variant_declaration(GQuark variant_name,return -EEXIST ;g_hash_table_insert (scope->variant_declarations, - (gpointer ) (unsigned long ) variant_name, +GUINT_TO_POINTER (variant_name), untagged_variant_declaration);bt_declaration_ref (&untagged_variant_declaration->p);@@ -440,7 +440,7 @@ struct declaration_enum * struct declaration_scope *scope) {return g_hash_table_lookup (scope->enum_declarations, - (gconstpointer ) (unsigned long ) enum_name); + (gconstpointer )GUINT_TO_POINTER (enum_name)); } struct declaration_enum *@@ -473,7 +473,7 @@ int bt_register_enum_declaration(GQuark enum_name,return -EEXIST ;g_hash_table_insert (scope->enum_declarations, - (gpointer ) (unsigned long ) enum_name, +GUINT_TO_POINTER (enum_name), enum_declaration);bt_declaration_ref (&enum_declaration->p);types/variant.c +6
-7@@ -227,8 +227,8 @@ void bt_untagged_variant_declaration_add_field(struct declaration_untagged_varia field->declaration = field_declaration;/* Keep index in hash rather than pointer, because array can relocate */ g_hash_table_insert (untagged_variant_declaration->fields_by_tag, - (gpointer ) (unsigned long ) field->name, - (gpointer ) index); +GUINT_TO_POINTER (field->name), +GUINT_TO_POINTER (index));/* * Alignment of variant is based on the alignment of its currently * selected choice, so we leave variant alignment as-is (statically @@ -244,13 +244,13 @@ bt_untagged_variant_declaration_get_field_from_tag(struct declaration_untagged_v found =g_hash_table_lookup_extended ( untagged_variant_declaration->fields_by_tag, - (gconstpointer ) (unsigned long ) tag,NULL , &index); + (gconstpointer )GUINT_TO_POINTER (tag),NULL , &index);if (!found) {return NULL ; } - return &g_array_index(untagged_variant_declaration->fields, struct declaration_field, (unsigned long)index); + return &g_array_index(untagged_variant_declaration->fields, struct declaration_field, GPOINTER_TO_UINT(index)); }/* @@ -279,7 +279,7 @@ struct bt_definition *bt_variant_get_current_field(struct definition_variant *vaassert (tag_array->len ==1 ); tag =g_array_index (tag_array, GQuark,0 );if (!g_hash_table_lookup_extended (variant_declaration->untagged_variant->fields_by_tag, - (gconstpointer ) (unsigned long ) tag, + (gconstpointer )GUINT_TO_POINTER (tag), &orig_key, &value)) {/* Cannot find matching field. */ @@ -287,7 +287,7 @@ struct bt_definition *bt_variant_get_current_field(struct definition_variant *va g_quark_to_string(tag));return NULL ; } - index = (unsigned long ) value; + index =GPOINTER_TO_UINT (value); variant->current_field =g_ptr_array_index (variant->fields, index);return variant->current_field; } --2.7.4
Signature · 7 lines
Jérémie Galarneau EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev