{
struct marker_info *info;
- info = g_hash_table_lookup(trace->markers_hash, (gconstpointer)name);
+ info = marker_get_info_from_name(trace, name);
if (!info)
g_error("Got marker format \"%s\", but marker name \"%s\" has no ID yet. "
"Kernel issue.",
int found = 0;
if (trace->markers->len <= id)
- trace->markers = g_array_set_size(trace->markers, id+1);
+ trace->markers = g_array_set_size(trace->markers,
+ max(trace->markers->len * 2, id + 1));
info = &g_array_index(trace->markers, struct marker_info, id);
info->name = name;
info->int_size = int_size;
info->size_t_size = size_t_size;
info->alignment = alignment;
info->next = NULL;
- head = g_hash_table_lookup(trace->markers_hash, (gconstpointer)name);
+ head = marker_get_info_from_name(trace, name);
if (!head)
- g_hash_table_insert(trace->markers_hash, (gpointer)name, info);
+ g_hash_table_insert(trace->markers_hash, (gpointer)name,
+ (gpointer)(gulong)id);
else {
struct marker_info *iter;
for (iter = head; iter != NULL; iter = iter->next)
if (iter->name == name)
found = 1;
if (!found) {
- g_hash_table_replace(trace->markers_hash, (gpointer)name, info);
+ g_hash_table_replace(trace->markers_hash, (gpointer)name,
+ (gpointer)(gulong)id);
info->next = head;
}
}
static inline struct marker_info *marker_get_info_from_name(LttTrace *trace,
GQuark name)
{
- return g_hash_table_lookup(trace->markers_hash, (gconstpointer)name);
+ gpointer orig_key, value;
+ guint16 id;
+ int res;
+
+ res = g_hash_table_lookup_extended(trace->markers_hash, (gconstpointer)name,
+ &orig_key, &value);
+ if (!res)
+ return NULL;
+ return marker_get_info_from_id(trace, (guint16)(gulong)value);
}
static inline struct marker_field *marker_get_field(struct marker_info *info,