Start packet mmap work
[babeltrace.git] / types / integer.c
index c207079defc661876225e38977fe1c0fcc7bb230..16cd903dc8aa8b7740859b0e7e30aae9bd4109a4 100644 (file)
@@ -23,7 +23,8 @@
 
 static
 struct definition *_integer_definition_new(struct declaration *declaration,
-                              struct definition_scope *parent_scope);
+                              struct definition_scope *parent_scope,
+                              GQuark field_name, int index);
 static
 void _integer_definition_free(struct definition *definition);
 
@@ -39,12 +40,14 @@ void integer_copy(struct stream_pos *dest, const struct format *fdest,
                uint64_t v;
 
                v = fsrc->uint_read(src, integer_declaration);
-               fdest->uint_write(dest, integer_declaration, v);
+               if (fdest)
+                       fdest->uint_write(dest, integer_declaration, v);
        } else {
                int64_t v;
 
                v = fsrc->int_read(src, integer_declaration);
-               fdest->int_write(dest, integer_declaration, v);
+               if (fdest)
+                       fdest->int_write(dest, integer_declaration, v);
        }
 }
 
@@ -57,14 +60,13 @@ void _integer_declaration_free(struct declaration *declaration)
 }
 
 struct declaration_integer *
-       integer_declaration_new(const char *name, size_t len, int byte_order,
+       integer_declaration_new(size_t len, int byte_order,
                         int signedness, size_t alignment)
 {
        struct declaration_integer *integer_declaration;
 
        integer_declaration = g_new(struct declaration_integer, 1);
        integer_declaration->p.id = CTF_TYPE_INTEGER;
-       integer_declaration->p.name = g_quark_from_string(name);
        integer_declaration->p.alignment = alignment;
        integer_declaration->p.copy = integer_copy;
        integer_declaration->p.declaration_free = _integer_declaration_free;
@@ -80,7 +82,8 @@ struct declaration_integer *
 static
 struct definition *
        _integer_definition_new(struct declaration *declaration,
-                               struct definition_scope *parent_scope)
+                               struct definition_scope *parent_scope,
+                               GQuark field_name, int index)
 {
        struct declaration_integer *integer_declaration =
                container_of(declaration, struct declaration_integer, p);
@@ -91,6 +94,7 @@ struct definition *
        integer->p.declaration = declaration;
        integer->declaration = integer_declaration;
        integer->p.ref = 1;
+       integer->p.index = index;
        integer->value._unsigned = 0;
        return &integer->p;
 }
This page took 0.023784 seconds and 4 git commands to generate.