MCPcopy Create free account
hub / github.com/commonmark/cmark / cmark_set_cstr

Function cmark_set_cstr

src/node.c:267–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267static bufsize_t cmark_set_cstr(cmark_mem *mem, unsigned char **dst,
268 const char *src) {
269 unsigned char *old = *dst;
270 bufsize_t len;
271
272 if (src && src[0]) {
273 len = (bufsize_t)strlen(src);
274 *dst = (unsigned char *)mem->realloc(NULL, len + 1);
275 memcpy(*dst, src, len + 1);
276 } else {
277 len = 0;
278 *dst = NULL;
279 }
280 if (old) {
281 mem->free(old);
282 }
283
284 return len;
285}
286
287void *cmark_node_get_user_data(cmark_node *node) {
288 if (node == NULL) {

Callers 6

cmark_node_set_literalFunction · 0.85
cmark_node_set_urlFunction · 0.85
cmark_node_set_titleFunction · 0.85
cmark_node_set_on_enterFunction · 0.85
cmark_node_set_on_exitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected