Dynamic scope: child position is MAX_INT
[babeltrace.git] / types / types.c
index 227a1e5e3125976730b79197a987e291e82a1714..fe1538f0102c6a1824bac0485eef3e2cb8125fed 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <babeltrace/format.h>
+#include <limits.h>
 #include <glib.h>
 #include <errno.h>
 
@@ -445,18 +446,17 @@ struct definition_scope *
        return scope;
 }
 
-/*
- * Same as new_definition_scope, but reset the scope path.
- */
-struct definition_scope *
-       new_dynamic_definition_scope(struct definition_scope *parent_scope,
-                                    GQuark field_name)
+void set_dynamic_definition_scope(struct definition *definition,
+                                 struct definition_scope *scope,
+                                 GQuark root_name)
 {
-       struct definition_scope *scope;
-
-       scope = _new_definition_scope(parent_scope, 1);
-       g_array_index(scope->scope_path, GQuark, 0) = field_name;
-       return scope;
+       g_array_set_size(scope->scope_path, 1);
+       g_array_index(scope->scope_path, GQuark, 0) = root_name;
+       /*
+        * Use INT_MAX order to ensure that all fields of the parent
+        * scope are seen as being prior to this scope.
+        */
+       definition->index = INT_MAX;
 }
 
 void free_definition_scope(struct definition_scope *scope)
This page took 0.024336 seconds and 4 git commands to generate.