84d9c625bf
- Fix for possible unset uid/gid in toproto - Fix for default mtree style - Update libelf - Importing libexecinfo - Resynchronize GCC, mpc, gmp, mpfr - build.sh: Replace params with show-params. This has been done as the make target has been renamed in the same way, while a new target named params has been added. This new target generates a file containing all the parameters, instead of printing it on the console. - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org) get getservbyport() out of the inner loop Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
44 lines
898 B
C
44 lines
898 B
C
/* $NetBSD: ialloc.c,v 1.9 2012/10/26 18:29:34 christos Exp $ */
|
|
/*
|
|
** This file is in the public domain, so clarified as of
|
|
** 2006-07-17 by Arthur David Olson.
|
|
*/
|
|
|
|
#if HAVE_NBTOOL_CONFIG_H
|
|
#include "nbtool_config.h"
|
|
#endif
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#if 0
|
|
static char elsieid[] = "@(#)ialloc.c 8.30";
|
|
#else
|
|
__RCSID("$NetBSD: ialloc.c,v 1.9 2012/10/26 18:29:34 christos Exp $");
|
|
#endif
|
|
|
|
#include "private.h"
|
|
|
|
char *
|
|
icatalloc(char *const old, const char *const new)
|
|
{
|
|
char * result;
|
|
int oldsize, newsize;
|
|
|
|
newsize = (new == NULL) ? 0 : strlen(new);
|
|
if (old == NULL)
|
|
oldsize = 0;
|
|
else if (newsize == 0)
|
|
return old;
|
|
else
|
|
oldsize = strlen(old);
|
|
if ((result = realloc(old, oldsize + newsize + 1)) != NULL)
|
|
if (new != NULL)
|
|
(void) strcpy(result + oldsize, new); /* XXX strcpy is safe */
|
|
return result;
|
|
}
|
|
|
|
char *
|
|
icpyalloc(const char *const string)
|
|
{
|
|
return icatalloc(NULL, string);
|
|
}
|