1 /* 2 ** This file is in the public domain, so clarified as of 3 ** 2006-07-17 by Arthur David Olson. 4 */ 5 6 /*LINTLIBRARY*/ 7 8 #include "private.h" 9 10 char * icatalloc(char * const old,const char * const new)11icatalloc(char *const old, const char *const new) 12 { 13 register char * result; 14 register int oldsize, newsize; 15 16 newsize = (new == NULL) ? 0 : strlen(new); 17 if (old == NULL) 18 oldsize = 0; 19 else if (newsize == 0) 20 return old; 21 else oldsize = strlen(old); 22 if ((result = realloc(old, oldsize + newsize + 1)) != NULL) 23 if (new != NULL) 24 (void) strcpy(result + oldsize, new); 25 return result; 26 } 27 28 char * icpyalloc(const char * const string)29icpyalloc(const char *const string) 30 { 31 return icatalloc(NULL, string); 32 } 33