Open dapaulid opened 9 years ago
@dapaulid even if I change json2protobuf_string() signature to "leaves allocation up to caller" it will affect only memory for root-level structure, not for all nested messages and other values. So it does not makes sense to me. I thought about allowing to use custom allocators all over the library code, but does not started this work yet. So if it will be useful for you - pull requests are always welcome.
Considering the following use case:
Why does the message output buffer require to be passed as
(ProtobufCMessage**)
? In my opinion it should be either(ProtobufCMessage*)
or(void*)
for the following reasons:calloc()
injson2protobuf_process_message()
for performance reasons. The caller needs to know the exact type anyway, as he is required to pass the message descriptor as well.