X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=types%2Ftypes.c;h=e63394692410ea3f6a885263c5969411caad321d;hp=08324acc481dd5e594525282d3329d4a15459f41;hb=2527e1494b783a60d8a874f28835700046f55dda;hpb=ff00cad2a14ea6dad073761b3dbb4aaa259723d0 diff --git a/types/types.c b/types/types.c index 08324acc..e6339469 100644 --- a/types/types.c +++ b/types/types.c @@ -1,5 +1,5 @@ /* - * declarations.c + * types.c * * BabelTrace - Converter * @@ -469,6 +469,34 @@ static struct definition_scope * return scope; } +GQuark new_definition_path(struct definition_scope *parent_scope, GQuark field_name) +{ + GQuark path; + GString *str; + gchar *c_str; + int i; + + str = g_string_new(""); + if (parent_scope) { + for (i = 0; i < parent_scope->scope_path->len; i++) { + GQuark q = g_array_index(parent_scope->scope_path, + GQuark, i); + if (!q) + continue; + g_string_append(str, g_quark_to_string(q)); + g_string_append(str, "."); + } + } + if (field_name) + g_string_append(str, g_quark_to_string(field_name)); + c_str = g_string_free(str, FALSE); + if (c_str[0] == '\0') + return 0; + path = g_quark_from_string(c_str); + g_free(c_str); + return path; +} + struct definition_scope * new_definition_scope(struct definition_scope *parent_scope, GQuark field_name)