Rename dynamic type field
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 17 Oct 2022 09:37:49 +0000 (05:37 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 17 Oct 2022 09:37:49 +0000 (05:37 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/side/trace.h
src/tracer.c

index 278b32f58ef4e6d25896e34a195ea654f175c13b..26b96e5507533835c438ee6645c0d446cd78fd3a 100644 (file)
@@ -152,7 +152,7 @@ struct side_arg_dynamic_vec_vla {
 };
 
 struct side_arg_dynamic_vec {
-       enum side_dynamic_type type;
+       enum side_dynamic_type dynamic_type;
        union {
                uint8_t side_u8;
                uint16_t side_u16;
@@ -191,7 +191,7 @@ struct side_arg_dynamic_event_struct {
 };
 
 struct side_arg_vec {
-       uint32_t type;  /* enum side_type */
+       enum side_type type;
        union {
                uint8_t side_u8;
                uint16_t side_u16;
@@ -365,32 +365,32 @@ struct side_tracer_dynamic_vla_visitor_ctx {
                }, \
        }
 
-#define side_arg_dynamic_null(val)     { .type = SIDE_DYNAMIC_TYPE_NULL }
+#define side_arg_dynamic_null(val)     { .dynamic_type = SIDE_DYNAMIC_TYPE_NULL }
 
-#define side_arg_dynamic_u8(val)       { .type = SIDE_DYNAMIC_TYPE_U8, .u = { .side_u8 = (val) } }
-#define side_arg_dynamic_u16(val)      { .type = SIDE_DYNAMIC_TYPE_U16, .u = { .side_u16 = (val) } }
-#define side_arg_dynamic_u32(val)      { .type = SIDE_DYNAMIC_TYPE_U32, .u = { .side_u32 = (val) } }
-#define side_arg_dynamic_u64(val)      { .type = SIDE_DYNAMIC_TYPE_U64, .u = { .side_u64 = (val) } }
-#define side_arg_dynamic_s8(val)       { .type = SIDE_DYNAMIC_TYPE_S8, .u = { .side_s8 = (val) } }
-#define side_arg_dynamic_s16(val)      { .type = SIDE_DYNAMIC_TYPE_S16, .u = { .side_s16 = (val) } }
-#define side_arg_dynamic_s32(val)      { .type = SIDE_DYNAMIC_TYPE_S32, .u = { .side_s32 = (val) } }
-#define side_arg_dynamic_s64(val)      { .type = SIDE_DYNAMIC_TYPE_S64, .u = { .side_s64 = (val) } }
-#define side_arg_dynamic_string(val)   { .type = SIDE_DYNAMIC_TYPE_STRING, .u = { .string = (val) } }
+#define side_arg_dynamic_u8(val)       { .dynamic_type = SIDE_DYNAMIC_TYPE_U8, .u = { .side_u8 = (val) } }
+#define side_arg_dynamic_u16(val)      { .dynamic_type = SIDE_DYNAMIC_TYPE_U16, .u = { .side_u16 = (val) } }
+#define side_arg_dynamic_u32(val)      { .dynamic_type = SIDE_DYNAMIC_TYPE_U32, .u = { .side_u32 = (val) } }
+#define side_arg_dynamic_u64(val)      { .dynamic_type = SIDE_DYNAMIC_TYPE_U64, .u = { .side_u64 = (val) } }
+#define side_arg_dynamic_s8(val)       { .dynamic_type = SIDE_DYNAMIC_TYPE_S8, .u = { .side_s8 = (val) } }
+#define side_arg_dynamic_s16(val)      { .dynamic_type = SIDE_DYNAMIC_TYPE_S16, .u = { .side_s16 = (val) } }
+#define side_arg_dynamic_s32(val)      { .dynamic_type = SIDE_DYNAMIC_TYPE_S32, .u = { .side_s32 = (val) } }
+#define side_arg_dynamic_s64(val)      { .dynamic_type = SIDE_DYNAMIC_TYPE_S64, .u = { .side_s64 = (val) } }
+#define side_arg_dynamic_string(val)   { .dynamic_type = SIDE_DYNAMIC_TYPE_STRING, .u = { .string = (val) } }
 
-#define side_arg_dynamic_vla(_vla)     { .type = SIDE_DYNAMIC_TYPE_VLA, .u = { .side_dynamic_vla = (_vla) } }
+#define side_arg_dynamic_vla(_vla)     { .dynamic_type = SIDE_DYNAMIC_TYPE_VLA, .u = { .side_dynamic_vla = (_vla) } }
 #define side_arg_dynamic_vla_visitor(_dynamic_vla_visitor, _ctx) \
        { \
-               .type = SIDE_DYNAMIC_TYPE_VLA_VISITOR, \
+               .dynamic_type = SIDE_DYNAMIC_TYPE_VLA_VISITOR, \
                .app_dynamic_visitor_ctx = _ctx, \
                .u = { \
                        .vla_visitor = _dynamic_vla_visitor, \
                }, \
        }
 
-#define side_arg_dynamic_struct(_struct)       { .type = SIDE_DYNAMIC_TYPE_STRUCT, .u = { .side_dynamic_struct = (_struct) } }
+#define side_arg_dynamic_struct(_struct)       { .dynamic_type = SIDE_DYNAMIC_TYPE_STRUCT, .u = { .side_dynamic_struct = (_struct) } }
 #define side_arg_dynamic_struct_visitor(_dynamic_struct_visitor, _ctx) \
        { \
-               .type = SIDE_DYNAMIC_TYPE_STRUCT_VISITOR, \
+               .dynamic_type = SIDE_DYNAMIC_TYPE_STRUCT_VISITOR, \
                .app_dynamic_visitor_ctx = _ctx, \
                .u = { \
                        .struct_visitor = _dynamic_struct_visitor, \
index b48baff5fedc5eccaf618dc79a5dffb8285ba826..8cba772f7b580ad50fd73972491ebe5f3024fd25 100644 (file)
@@ -241,70 +241,43 @@ void tracer_print_array_fixint(const struct side_type_description *type_desc, co
        enum side_type side_type;
        int i;
 
-       if (elem_type->type != SIDE_TYPE_DYNAMIC) {
-               switch (item->type) {
-               case SIDE_TYPE_ARRAY_U8:
-                       if (elem_type->type != SIDE_TYPE_U8)
-                               goto type_error;
-                       break;
-               case SIDE_TYPE_ARRAY_U16:
-                       if (elem_type->type != SIDE_TYPE_U16)
-                               goto type_error;
-                       break;
-               case SIDE_TYPE_ARRAY_U32:
-                       if (elem_type->type != SIDE_TYPE_U32)
-                               goto type_error;
-                       break;
-               case SIDE_TYPE_ARRAY_U64:
-                       if (elem_type->type != SIDE_TYPE_U64)
-                               goto type_error;
-                       break;
-               case SIDE_TYPE_ARRAY_S8:
-                       if (elem_type->type != SIDE_TYPE_S8)
-                               goto type_error;
-                       break;
-               case SIDE_TYPE_ARRAY_S16:
-                       if (elem_type->type != SIDE_TYPE_S16)
-                               goto type_error;
-                       break;
-               case SIDE_TYPE_ARRAY_S32:
-                       if (elem_type->type != SIDE_TYPE_S32)
-                               goto type_error;
-                       break;
-               case SIDE_TYPE_ARRAY_S64:
-                       if (elem_type->type != SIDE_TYPE_S64)
-                               goto type_error;
-                       break;
-               }
-               side_type = elem_type->type;
-       } else {
-               switch (item->type) {
-               case SIDE_TYPE_ARRAY_U8:
-                       side_type = SIDE_TYPE_U8;
-                       break;
-               case SIDE_TYPE_ARRAY_U16:
-                       side_type = SIDE_TYPE_U16;
-                       break;
-               case SIDE_TYPE_ARRAY_U32:
-                       side_type = SIDE_TYPE_U32;
-                       break;
-               case SIDE_TYPE_ARRAY_U64:
-                       side_type = SIDE_TYPE_U64;
-                       break;
-               case SIDE_TYPE_ARRAY_S8:
-                       side_type = SIDE_TYPE_S8;
-                       break;
-               case SIDE_TYPE_ARRAY_S16:
-                       side_type = SIDE_TYPE_S16;
-                       break;
-               case SIDE_TYPE_ARRAY_S32:
-                       side_type = SIDE_TYPE_S32;
-                       break;
-               case SIDE_TYPE_ARRAY_S64:
-                       side_type = SIDE_TYPE_S64;
-                       break;
-               }
+       switch (item->type) {
+       case SIDE_TYPE_ARRAY_U8:
+               if (elem_type->type != SIDE_TYPE_U8)
+                       goto type_error;
+               break;
+       case SIDE_TYPE_ARRAY_U16:
+               if (elem_type->type != SIDE_TYPE_U16)
+                       goto type_error;
+               break;
+       case SIDE_TYPE_ARRAY_U32:
+               if (elem_type->type != SIDE_TYPE_U32)
+                       goto type_error;
+               break;
+       case SIDE_TYPE_ARRAY_U64:
+               if (elem_type->type != SIDE_TYPE_U64)
+                       goto type_error;
+               break;
+       case SIDE_TYPE_ARRAY_S8:
+               if (elem_type->type != SIDE_TYPE_S8)
+                       goto type_error;
+               break;
+       case SIDE_TYPE_ARRAY_S16:
+               if (elem_type->type != SIDE_TYPE_S16)
+                       goto type_error;
+               break;
+       case SIDE_TYPE_ARRAY_S32:
+               if (elem_type->type != SIDE_TYPE_S32)
+                       goto type_error;
+               break;
+       case SIDE_TYPE_ARRAY_S64:
+               if (elem_type->type != SIDE_TYPE_S64)
+                       goto type_error;
+               break;
+       default:
+               goto type_error;
        }
+       side_type = elem_type->type;
 
        printf("[ ");
        for (i = 0; i < side_sav_len; i++) {
@@ -494,7 +467,7 @@ void tracer_print_dynamic_vla_visitor(const struct side_arg_dynamic_vec *item)
 static
 void tracer_print_dynamic(const struct side_arg_dynamic_vec *item)
 {
-       switch (item->type) {
+       switch (item->dynamic_type) {
        case SIDE_DYNAMIC_TYPE_NULL:
                printf("<NULL TYPE>");
                break;
This page took 0.02765 seconds and 4 git commands to generate.