diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py index 8d3f5cb..7b53361 100644 --- a/python_modules/demarshal.py +++ b/python_modules/demarshal.py @@ -1039,8 +1039,7 @@ def write_msg_parser(writer, message): msg_type = message.c_type() msg_sizeof = message.sizeof() - want_mem_size = (len(message.members) != 1 or message.members[0].is_fixed_nw_size() - or not message.members[0].is_array()) + want_mem_size = not message.has_attr("nocopy") writer.newline() if message.has_attr("ifdef"): diff --git a/tests/test-marshallers.h b/tests/test-marshallers.h index 7e5a0b2..7b9f6c5 100644 --- a/tests/test-marshallers.h +++ b/tests/test-marshallers.h @@ -8,5 +8,9 @@ typedef struct { uint64_t *data; } SpiceMsgMainShortDataSubMarshall; +typedef struct { + int8_t *name; +} SpiceMsgMainArrayMessage; + #endif /* _H_TEST_MARSHALLERS */ diff --git a/tests/test-marshallers.proto b/tests/test-marshallers.proto index 68b5822..95d086c 100644 --- a/tests/test-marshallers.proto +++ b/tests/test-marshallers.proto @@ -4,6 +4,10 @@ channel TestChannel { uint32 data_size; uint64 *data[data_size] @marshall; } ShortDataSubMarshall; + + message { + int8 name[]; + } ArrayMessage; }; protocol Spice {