mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2025-11-21 13:41:50 +00:00
Remove need for ialloc.c
One of its functions, icpyalloc, duplicates the now-standard function strdup, and we might as well use the standard function. Its other function, icatalloc, is used only in O(N**2) algorithms that can be rewritten to be O(N). * Makefile: Mention HAVE_STRDUP in commentary. (TZCOBJS): Remove ialloc.o. (NONLIBSRCS): Remove ialloc.c. (ialloc.o): Remove. * ialloc.c: Remove. * private.h (HAVE_STRDUP): New macro, defaulting to 1. (icatalloc, icpyalloc): Remove decls. * zic.c (end): Remove. (strdup) [!HAVE_STRDUP]: New function. (memcheck): Arg is no longer a const pointer, since the result isn't. (emalloc, erealloc, ecpyalloc): Now functions, not macros. (ecpyalloc): Use strdup, not icpyalloc. (ecatalloc): Remove. All callers changed. (componentcheck): Check that file name components are nonempty; otherwise, relname might return nonsense. (relname): New function. (dolink, itsdir, writezone): Use it. (dolink, stringrule, stringzone): Rewrite to avoid O(N**2) algorithm involving 'strcat' and 'end'. (writezone): Use local, not static, to store fullname, and free it before returning. (doabbr, stringoffset): Return strlen of result.
This commit is contained in:
6
Makefile
6
Makefile
@ -120,6 +120,7 @@ LDLIBS=
|
||||
# -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
|
||||
# -DHAVE_STRFTIME_L=1 if <time.h> declares locale_t and strftime_l
|
||||
# This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise.
|
||||
# -DHAVE_STRDUP=0 if your system lacks the strdup function
|
||||
# -DHAVE_SYMLINK=0 if your system lacks the symlink function
|
||||
# -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h"
|
||||
# -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"
|
||||
@ -330,13 +331,13 @@ AR= ar
|
||||
# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
|
||||
RANLIB= :
|
||||
|
||||
TZCOBJS= zic.o scheck.o ialloc.o
|
||||
TZCOBJS= zic.o scheck.o
|
||||
TZDOBJS= zdump.o localtime.o asctime.o
|
||||
DATEOBJS= date.o localtime.o strftime.o asctime.o
|
||||
LIBSRCS= localtime.c asctime.c difftime.c
|
||||
LIBOBJS= localtime.o asctime.o difftime.o
|
||||
HEADERS= tzfile.h private.h
|
||||
NONLIBSRCS= zic.c zdump.c scheck.c ialloc.c
|
||||
NONLIBSRCS= zic.c zdump.c scheck.c
|
||||
NEWUCBSRCS= date.c strftime.c
|
||||
SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
|
||||
tzselect.ksh workman.sh
|
||||
@ -654,7 +655,6 @@ zonenames: $(TDATA)
|
||||
asctime.o: private.h tzfile.h
|
||||
date.o: private.h
|
||||
difftime.o: private.h
|
||||
ialloc.o: private.h
|
||||
localtime.o: private.h tzfile.h
|
||||
scheck.o: private.h
|
||||
strftime.o: private.h tzfile.h
|
||||
|
||||
Reference in New Issue
Block a user