1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-11-21 18:20:59 +00:00
Files
amiga-tz/ialloc.c

33 lines
614 B
C
Raw Normal View History

/*
** This file is in the public domain, so clarified as of
** 2006-07-17 by Arthur David Olson.
*/
/*LINTLIBRARY*/
#include "private.h"
char *
Assume C89. * Makefile (GCC_DEBUG_FLAGS): Modernize for GCC 4.6.3 x86. * asctime.c (asctime_r, asctime): * date.c (main, dogmt, reset, wildinput, nondigit, oops, display) (timeout, sametm, netsettime): * difftime.c (difftime): * ialloc.c (icatalloc, icpyalloc): * localtime.c (detzcode, detzcode64, differ_by_repeat) (tzload, typesequiv, getzname, getnum, getsecs, getoffset) (getrule, transtime, tzparse, gmtload, tzsetwall, tzset) (localsub, localtime, localtime_r, gmtsub, gmtime, gmtime_r) (offtime, leaps_thru_end_of, timesub, ctime, ctime_r) (increment_overflow, long_increment_overflow) (normalize_overflow, long_normalize_overflow, tmcomp, time2sub) (time2, time1, mktime, timelocal, timegm, timeoff, gtime) (leapcorr, time2posix, posix2time): * scheck.c (scheck): * strftime.c (strftime, _fmt, _conv, _add, _yconv, _loc): * zdump.c (my_localtime, abbrok, usage, main, yeartot) (delta, abbr, dumptime): * zic.c (memcheck, eats, eat, error, warning, main) (dolink, itsdir, rcomp, associate, infile, gethms, inrule) (inzone, inzcont, inzsub, inleap, inlink, rulesub, convert) (convert64, puttzcode, puttzcode64, atcomp, is32, writezone, DO) (doabbr, updateminmax, stringoffset, stringrule, stringzone) (outzone, addtt, addtype, leapadd, yearistype, lowerit, ciequal) (itsabbr, byword, getfields, oadd, tadd, rpytime, newabbr) (mkdirs, eitol): Assume C89 or better. Mostly this consists of using function prototypes. In a few places, prototypes are required for portability to hosts where time_t does not promote to itself and where a preceding prototype does not override a definition. But while we're at it we might as well be consistent: it's safe to assume at-least-C89 these days. * ialloc.c (nonzero, imalloc, icalloc, irealloc, ifree, icfree): Remove; no longer needed now that we assume C89 or better. All callers changed to use malloc, calloc, realloc, free. * localtime.c (getzname, getqzname, leaps_thru_end_of, transtime): * zdump.c (delta, yeartot): * zic.c (eitol): Now pure. * private.h, zdump.c (ATTRIBUTE_PURE): New macro. * private.h (icalloc, imalloc, irealloc, icfree, ifree): Remove decls. * zic.c: Remove no-longer-necessary forward decls. (max_time, min_time): Now const. (setboundaries): Remove.
2012-10-12 07:53:12 -07:00
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);
Assume C89. * Makefile (GCC_DEBUG_FLAGS): Modernize for GCC 4.6.3 x86. * asctime.c (asctime_r, asctime): * date.c (main, dogmt, reset, wildinput, nondigit, oops, display) (timeout, sametm, netsettime): * difftime.c (difftime): * ialloc.c (icatalloc, icpyalloc): * localtime.c (detzcode, detzcode64, differ_by_repeat) (tzload, typesequiv, getzname, getnum, getsecs, getoffset) (getrule, transtime, tzparse, gmtload, tzsetwall, tzset) (localsub, localtime, localtime_r, gmtsub, gmtime, gmtime_r) (offtime, leaps_thru_end_of, timesub, ctime, ctime_r) (increment_overflow, long_increment_overflow) (normalize_overflow, long_normalize_overflow, tmcomp, time2sub) (time2, time1, mktime, timelocal, timegm, timeoff, gtime) (leapcorr, time2posix, posix2time): * scheck.c (scheck): * strftime.c (strftime, _fmt, _conv, _add, _yconv, _loc): * zdump.c (my_localtime, abbrok, usage, main, yeartot) (delta, abbr, dumptime): * zic.c (memcheck, eats, eat, error, warning, main) (dolink, itsdir, rcomp, associate, infile, gethms, inrule) (inzone, inzcont, inzsub, inleap, inlink, rulesub, convert) (convert64, puttzcode, puttzcode64, atcomp, is32, writezone, DO) (doabbr, updateminmax, stringoffset, stringrule, stringzone) (outzone, addtt, addtype, leapadd, yearistype, lowerit, ciequal) (itsabbr, byword, getfields, oadd, tadd, rpytime, newabbr) (mkdirs, eitol): Assume C89 or better. Mostly this consists of using function prototypes. In a few places, prototypes are required for portability to hosts where time_t does not promote to itself and where a preceding prototype does not override a definition. But while we're at it we might as well be consistent: it's safe to assume at-least-C89 these days. * ialloc.c (nonzero, imalloc, icalloc, irealloc, ifree, icfree): Remove; no longer needed now that we assume C89 or better. All callers changed to use malloc, calloc, realloc, free. * localtime.c (getzname, getqzname, leaps_thru_end_of, transtime): * zdump.c (delta, yeartot): * zic.c (eitol): Now pure. * private.h, zdump.c (ATTRIBUTE_PURE): New macro. * private.h (icalloc, imalloc, irealloc, icfree, ifree): Remove decls. * zic.c: Remove no-longer-necessary forward decls. (max_time, min_time): Now const. (setboundaries): Remove.
2012-10-12 07:53:12 -07:00
if ((result = realloc(old, oldsize + newsize + 1)) != NULL)
if (new != NULL)
strcpy(result + oldsize, new);
return result;
}
char *
Assume C89. * Makefile (GCC_DEBUG_FLAGS): Modernize for GCC 4.6.3 x86. * asctime.c (asctime_r, asctime): * date.c (main, dogmt, reset, wildinput, nondigit, oops, display) (timeout, sametm, netsettime): * difftime.c (difftime): * ialloc.c (icatalloc, icpyalloc): * localtime.c (detzcode, detzcode64, differ_by_repeat) (tzload, typesequiv, getzname, getnum, getsecs, getoffset) (getrule, transtime, tzparse, gmtload, tzsetwall, tzset) (localsub, localtime, localtime_r, gmtsub, gmtime, gmtime_r) (offtime, leaps_thru_end_of, timesub, ctime, ctime_r) (increment_overflow, long_increment_overflow) (normalize_overflow, long_normalize_overflow, tmcomp, time2sub) (time2, time1, mktime, timelocal, timegm, timeoff, gtime) (leapcorr, time2posix, posix2time): * scheck.c (scheck): * strftime.c (strftime, _fmt, _conv, _add, _yconv, _loc): * zdump.c (my_localtime, abbrok, usage, main, yeartot) (delta, abbr, dumptime): * zic.c (memcheck, eats, eat, error, warning, main) (dolink, itsdir, rcomp, associate, infile, gethms, inrule) (inzone, inzcont, inzsub, inleap, inlink, rulesub, convert) (convert64, puttzcode, puttzcode64, atcomp, is32, writezone, DO) (doabbr, updateminmax, stringoffset, stringrule, stringzone) (outzone, addtt, addtype, leapadd, yearistype, lowerit, ciequal) (itsabbr, byword, getfields, oadd, tadd, rpytime, newabbr) (mkdirs, eitol): Assume C89 or better. Mostly this consists of using function prototypes. In a few places, prototypes are required for portability to hosts where time_t does not promote to itself and where a preceding prototype does not override a definition. But while we're at it we might as well be consistent: it's safe to assume at-least-C89 these days. * ialloc.c (nonzero, imalloc, icalloc, irealloc, ifree, icfree): Remove; no longer needed now that we assume C89 or better. All callers changed to use malloc, calloc, realloc, free. * localtime.c (getzname, getqzname, leaps_thru_end_of, transtime): * zdump.c (delta, yeartot): * zic.c (eitol): Now pure. * private.h, zdump.c (ATTRIBUTE_PURE): New macro. * private.h (icalloc, imalloc, irealloc, icfree, ifree): Remove decls. * zic.c: Remove no-longer-necessary forward decls. (max_time, min_time): Now const. (setboundaries): Remove.
2012-10-12 07:53:12 -07:00
icpyalloc(const char *const string)
{
Assume C89. * Makefile (GCC_DEBUG_FLAGS): Modernize for GCC 4.6.3 x86. * asctime.c (asctime_r, asctime): * date.c (main, dogmt, reset, wildinput, nondigit, oops, display) (timeout, sametm, netsettime): * difftime.c (difftime): * ialloc.c (icatalloc, icpyalloc): * localtime.c (detzcode, detzcode64, differ_by_repeat) (tzload, typesequiv, getzname, getnum, getsecs, getoffset) (getrule, transtime, tzparse, gmtload, tzsetwall, tzset) (localsub, localtime, localtime_r, gmtsub, gmtime, gmtime_r) (offtime, leaps_thru_end_of, timesub, ctime, ctime_r) (increment_overflow, long_increment_overflow) (normalize_overflow, long_normalize_overflow, tmcomp, time2sub) (time2, time1, mktime, timelocal, timegm, timeoff, gtime) (leapcorr, time2posix, posix2time): * scheck.c (scheck): * strftime.c (strftime, _fmt, _conv, _add, _yconv, _loc): * zdump.c (my_localtime, abbrok, usage, main, yeartot) (delta, abbr, dumptime): * zic.c (memcheck, eats, eat, error, warning, main) (dolink, itsdir, rcomp, associate, infile, gethms, inrule) (inzone, inzcont, inzsub, inleap, inlink, rulesub, convert) (convert64, puttzcode, puttzcode64, atcomp, is32, writezone, DO) (doabbr, updateminmax, stringoffset, stringrule, stringzone) (outzone, addtt, addtype, leapadd, yearistype, lowerit, ciequal) (itsabbr, byword, getfields, oadd, tadd, rpytime, newabbr) (mkdirs, eitol): Assume C89 or better. Mostly this consists of using function prototypes. In a few places, prototypes are required for portability to hosts where time_t does not promote to itself and where a preceding prototype does not override a definition. But while we're at it we might as well be consistent: it's safe to assume at-least-C89 these days. * ialloc.c (nonzero, imalloc, icalloc, irealloc, ifree, icfree): Remove; no longer needed now that we assume C89 or better. All callers changed to use malloc, calloc, realloc, free. * localtime.c (getzname, getqzname, leaps_thru_end_of, transtime): * zdump.c (delta, yeartot): * zic.c (eitol): Now pure. * private.h, zdump.c (ATTRIBUTE_PURE): New macro. * private.h (icalloc, imalloc, irealloc, icfree, ifree): Remove decls. * zic.c: Remove no-longer-necessary forward decls. (max_time, min_time): Now const. (setboundaries): Remove.
2012-10-12 07:53:12 -07:00
return icatalloc(NULL, string);
}