trace.h: Use side_ptr_t for string_value pointer
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Sep 2023 09:35:15 +0000 (10:35 +0100)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Sep 2023 09:35:15 +0000 (10:35 +0100)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/side/trace.h
src/tracer.c

index 76c82b84dcaa328329542f616e1305696498c6ee..22cdec31cb9240e1a09208790680da499e1276e4 100644 (file)
@@ -525,7 +525,7 @@ union side_arg_static {
        /* Stack-copy basic types */
        union side_bool_value bool_value;
        uint8_t byte_value;
-       uint64_t string_value;  /* const {uint8_t, uint16_t, uint32_t} * */
+       side_ptr_t(const void) string_value;    /* const {uint8_t, uint16_t, uint32_t} * */
        union side_integer_value integer_value;
        union side_float_value float_value;
 
@@ -1427,9 +1427,9 @@ struct side_event_description {
 #define side_arg_null(_val)            { .type = SIDE_TYPE_NULL }
 #define side_arg_bool(_val)            { .type = SIDE_TYPE_BOOL, .u = { .side_static = { .bool_value = { .side_bool8 = !!(_val) } } } }
 #define side_arg_byte(_val)            { .type = SIDE_TYPE_BYTE, .u = { .side_static = { .byte_value = (_val) } } }
-#define side_arg_string(_val)          { .type = SIDE_TYPE_STRING_UTF8, .u = { .side_static = { .string_value = (uintptr_t) (_val) } } }
-#define side_arg_string16(_val)                { .type = SIDE_TYPE_STRING_UTF16, .u = { .side_static = { .string_value = (uintptr_t) (_val) } } }
-#define side_arg_string32(_val)                { .type = SIDE_TYPE_STRING_UTF32, .u = { .side_static = { .string_value = (uintptr_t) (_val) } } }
+#define side_arg_string(_val)          { .type = SIDE_TYPE_STRING_UTF8, .u = { .side_static = { .string_value = SIDE_PTR_INIT(_val) } } }
+#define side_arg_string16(_val)                { .type = SIDE_TYPE_STRING_UTF16, .u = { .side_static = { .string_value = SIDE_PTR_INIT(_val) } } }
+#define side_arg_string32(_val)                { .type = SIDE_TYPE_STRING_UTF32, .u = { .side_static = { .string_value = SIDE_PTR_INIT(_val) } } }
 
 #define side_arg_u8(_val)              { .type = SIDE_TYPE_U8, .u = { .side_static = {  .integer_value = { .side_u8 = (_val) } } } }
 #define side_arg_u16(_val)             { .type = SIDE_TYPE_U16, .u = { .side_static = { .integer_value = { .side_u16 = (_val) } } } }
index c7c1cc845db6561765e81be4385f4003d688ef74..65887fb70ca669634147b42795ae5cfbf3c0c0d8 100644 (file)
@@ -946,7 +946,7 @@ void tracer_print_type(const struct side_type *type_desc, const struct side_arg
        case SIDE_TYPE_STRING_UTF16:
        case SIDE_TYPE_STRING_UTF32:
                tracer_print_type_header(":", side_ptr_get(type_desc->u.side_string.attr), type_desc->u.side_string.nr_attr);
-               tracer_print_string((const void *)(uintptr_t) item->u.side_static.string_value,
+               tracer_print_string(side_ptr_get(item->u.side_static.string_value),
                                type_desc->u.side_string.unit_size, type_desc->u.side_string.byte_order, NULL);
                break;
 
This page took 0.033778 seconds and 4 git commands to generate.