MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / sendReceived2String

Function sendReceived2String

test/test_lists/test_lists_server_impl.cpp:215–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215list_string_2_t *sendReceived2String(const list_string_2_t *received_list)
216{
217 list_string_2_t *send_list;
218 char *stringValue = (char *)" World!";
219 send_list = (list_string_2_t *)erpc_malloc(sizeof(list_string_2_t));
220 list_string_1_t *list_int32_1_t_r = received_list->elements;
221 send_list->elementsCount = received_list->elementsCount;
222 send_list->elements = (list_string_1_t *)erpc_malloc(send_list->elementsCount * sizeof(list_string_1_t));
223 list_string_1_t *list_int32_1_t_s = send_list->elements;
224 for (uint32_t i = 0; i < send_list->elementsCount; ++i)
225 {
226 char **list_s, **list_r;
227 list_r = list_int32_1_t_r->elements;
228 list_int32_1_t_s->elementsCount = list_int32_1_t_r->elementsCount;
229 list_int32_1_t_s->elements = (char **)erpc_malloc(list_int32_1_t_s->elementsCount * sizeof(char *));
230 list_s = list_int32_1_t_s->elements;
231 for (uint32_t j = 0; j < list_int32_1_t_s->elementsCount; ++j)
232 {
233 *list_s = (char *)erpc_malloc((strlen(*list_r) + strlen(stringValue) + 1) * sizeof(char));
234 strcpy(*list_s, *list_r);
235 strcat(*list_s, stringValue);
236 ++list_r;
237 ++list_s;
238 }
239 ++list_int32_1_t_r;
240 ++list_int32_1_t_s;
241 }
242
243 return send_list;
244}
245
246void test_list_allDirection(const list_uint32_1_t *a, const list_uint32_1_t *b, list_uint32_1_t *e)
247{

Callers 4

sendReceived2StringMethod · 0.85
TESTFunction · 0.85
TESTFunction · 0.85

Calls 1

erpc_mallocFunction · 0.50

Tested by

no test coverage detected