MCPcopy Create free account
hub / github.com/F-Stack/f-stack / xo_string_add

Function xo_string_add

tools/libxo/libxo/xo_encoder.c:59–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59static inline xo_string_node_t *
60xo_string_add (xo_string_list_t *listp, const char *str)
61{
62 if (listp == NULL || str == NULL)
63 return NULL;
64
65 xo_string_list_init(listp);
66 size_t len = strlen(str);
67 xo_string_node_t *xsp;
68
69 xsp = xo_realloc(NULL, sizeof(*xsp) + len + 1);
70 if (xsp) {
71 memcpy(xsp->xs_data, str, len);
72 xsp->xs_data[len] = '\0';
73 TAILQ_INSERT_TAIL(listp, xsp, xs_link);
74 }
75
76 return xsp;
77}
78
79#define XO_STRING_LIST_FOREACH(_xsp, _listp) \
80 xo_string_list_init(_listp); \

Callers 1

xo_encoder_path_addFunction · 0.85

Calls 2

xo_string_list_initFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected