diff options
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..4863e29 --- /dev/null +++ b/src/util.c @@ -0,0 +1,16 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <util.h> + +void +xstrcat(char *s1, char *s2) +{ + size_t a = strlen(s1); + size_t b = strlen(s2); + size_t size_ab = a + b + 1; + + s1 = realloc(s1, size_ab); + + memcpy(s1 + a, s2, b + 1); +} |