diff options
Diffstat (limited to 'src/include/string.h')
-rw-r--r-- | src/include/string.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/include/string.h b/src/include/string.h index b4d0268419..b862194979 100644 --- a/src/include/string.h +++ b/src/include/string.h @@ -56,6 +56,16 @@ static inline char *strdup(const char *s) memcpy(d, s, sz); return d; } + +static inline char *strconcat(const char *s1, const char *s2) +{ + size_t sz_1 = strlen(s1); + size_t sz_2 = strlen(s2); + char *d = malloc(sz_1 + sz_2 + 1); + memcpy(d, s1, sz_1); + memcpy(d + sz_1, s2, sz_2 + 1); + return d; +} #endif static inline char *strncpy(char *to, const char *from, int count) |