bolt/bootstrap/cxx/deps/icu/source/tools/tzcode/ialloc.c
Sam Vervaeck 285f33e93c Add 'bootstrap/cxx/' from commit '7c1a929e9a3d3abb1e2113f531588e059ad5be8c'
git-subtree-dir: bootstrap/cxx
git-subtree-mainline: b732e418cb
git-subtree-split: 7c1a929e9a
2024-01-15 14:04:51 +01:00

32 lines
621 B
C

/*
** This file is in the public domain, so clarified as of
** 2006-07-17 by Arthur David Olson.
*/
/*LINTLIBRARY*/
#include "private.h"
char *
icatalloc(char *const old, const char *const new)
{
register char * result;
register 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);
return result;
}
char *
icpyalloc(const char *const string)
{
return icatalloc(NULL, string);
}