aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
blob: 4863e29fcbb412f452428abf64b84a93c0282d2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
}