blob: df2fd808491d102d1c468a39c02877ea68873fd7 [file] [log] [blame]
Thomas Heijligen92043552019-01-29 12:48:01 +01001#include <string.h>
2#include <stddef.h>
3#include <stdlib.h>
4
5char *strdup(const char *s)
6{
7 size_t sz = strlen(s) + 1;
8 char *d = malloc(sz);
9 memcpy(d, s, sz);
10 return d;
11}
12
13char *strconcat(const char *s1, const char *s2)
14{
15 size_t sz_1 = strlen(s1);
16 size_t sz_2 = strlen(s2);
17 char *d = malloc(sz_1 + sz_2 + 1);
18 memcpy(d, s1, sz_1);
19 memcpy(d + sz_1, s2, sz_2 + 1);
20 return d;
21}