1 /* $NetBSD: ialloc.c,v 1.9 2012/10/26 18:29:34 christos Exp $ */
3 ** This file is in the public domain, so clarified as of
4 ** 2006-07-17 by Arthur David Olson.
7 #if HAVE_NBTOOL_CONFIG_H
8 #include "nbtool_config.h"
11 #include <sys/cdefs.h>
14 static char elsieid
[] = "@(#)ialloc.c 8.30";
16 __RCSID("$NetBSD: ialloc.c,v 1.9 2012/10/26 18:29:34 christos Exp $");
22 icatalloc(char *const old
, const char *const new)
27 newsize
= (new == NULL
) ? 0 : strlen(new);
30 else if (newsize
== 0)
33 oldsize
= strlen(old
);
34 if ((result
= realloc(old
, oldsize
+ newsize
+ 1)) != NULL
)
36 (void) strcpy(result
+ oldsize
, new); /* XXX strcpy is safe */
41 icpyalloc(const char *const string
)
43 return icatalloc(NULL
, string
);