MCPcopy Create free account
hub / github.com/GJDuck/e9patch / strdup

Function strdup

examples/stdlib.c:2708–2718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2706}
2707
2708static char *strdup(const char *src)
2709{
2710 if (src == NULL)
2711 return NULL;
2712 size_t len = strlen(src);
2713 char *dst = (char *)malloc(len+1);
2714 if (dst == NULL)
2715 return NULL;
2716 memcpy(dst, src, len+1);
2717 return dst;
2718}
2719
2720static const char *strerror(int errnum)
2721{

Callers 3

internal_functionFunction · 0.85
test_stringFunction · 0.85
dupStringFunction · 0.85

Calls 3

mallocFunction · 0.85
memcpyFunction · 0.85
strlenFunction · 0.70

Tested by 1

test_stringFunction · 0.68