summaryrefslogtreecommitdiff
path: root/src/libstddjb/alloc_realloc.c
blob: 82be92b5b10ca6d183229595171e4656e3908327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* ISC license. */

#include <stdlib.h>
#include <skalibs/alloc.h>

int alloc_realloc (char **x, size_t n)
{
  char *y = n ? (char *)realloc(*x, n) : (free(*x), (char *)alloc(0)) ;
  if (!y) return 0 ;
  *x = y ;
  return 1 ;
}