summaryrefslogtreecommitdiff
path: root/05/musl-0.6.0/src/string
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-02-23 22:37:01 -0800
committerpommicket <pommicket@gmail.com>2022-02-23 22:37:01 -0800
commitc75af0c8e5fdf7792081f03ca8a01764953b19a4 (patch)
tree811fcdb32086c0b5b4a41f18031c8fcde65ca4b6 /05/musl-0.6.0/src/string
parent9bc8a11afeed3569736b89754012e3ca22ee10f6 (diff)
coda
Diffstat (limited to '05/musl-0.6.0/src/string')
-rw-r--r--05/musl-0.6.0/src/string/strdup.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/05/musl-0.6.0/src/string/strdup.c b/05/musl-0.6.0/src/string/strdup.c
index dd5f80c..defd559 100644
--- a/05/musl-0.6.0/src/string/strdup.c
+++ b/05/musl-0.6.0/src/string/strdup.c
@@ -10,4 +10,10 @@ char *__strdup(const char *s)
return memcpy(d, s, l+1);
}
-weak_alias(__strdup, strdup);
+char *strdup(const char *s)
+{
+ size_t l = strlen(s);
+ char *d = malloc(l+1);
+ if (!d) return NULL;
+ return memcpy(d, s, l+1);
+}