change return string value

This commit is contained in:
vms 2019-08-20 11:47:06 +02:00
parent cf0d0fa94b
commit f7b1cd2cb3

View File

@ -43,16 +43,17 @@ char * module_name ## _call(const char *ptr, int length) { \
char *result = module_name ## _invoke(request_ptr, length); \
\
unsigned int result_size = 0; \
char *result_out = malloc(result_size + 4);\
for (int i = 0; i < 4; ++i) { \
result_out[i] = result[i]; \
result_size = result_size | ((unsigned int)result[i] << 8*i); \
} \
\
char *result_out = malloc(result_size + 1); \
for(int i = 0; i < result_size; ++i) { \
result_out[i] = module_name ## _load(result + 4 + i); \
}\
\
result_out[result_size] = '\0'; \
\
module_name ## _deallocate(result, result_size); \
\
return result_out;\