diff options
author | Tom Lane | 2004-05-21 05:08:06 +0000 |
---|---|---|
committer | Tom Lane | 2004-05-21 05:08:06 +0000 |
commit | 63bd0db12199c5df043e1dea0f2b574f622b3a4c (patch) | |
tree | dbafdb6e4541162ad369dbfeca24cbd62aefddcc /src/timezone/ialloc.c | |
parent | 260b513fc37b6ed2df51586c487d0832b89d0d70 (diff) |
Integrate src/timezone library for all platforms. There is more we can
and should do now that we control our own destiny for timezone handling,
but this commit gets the bulk of the picayune diffs in place.
Magnus Hagander and Tom Lane.
Diffstat (limited to 'src/timezone/ialloc.c')
-rw-r--r-- | src/timezone/ialloc.c | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/src/timezone/ialloc.c b/src/timezone/ialloc.c index 8a0c7015789..b723f932c85 100644 --- a/src/timezone/ialloc.c +++ b/src/timezone/ialloc.c @@ -1,46 +1,30 @@ -#ifndef lint -#ifndef NOID -static char elsieid[] = "@(#)ialloc.c 8.29"; -#endif /* !defined NOID */ -#endif /* !defined lint */ - -/*LINTLIBRARY*/ +#include "postgres.h" #include "private.h" + #define nonzero(n) (((n) == 0) ? 1 : (n)) -char * -imalloc(n) -const int n; +char *imalloc(const int n) { return malloc((size_t) nonzero(n)); } -char * -icalloc(nelem, elsize) -int nelem; -int elsize; +char *icalloc(int nelem, int elsize) { if (nelem == 0 || elsize == 0) nelem = elsize = 1; return calloc((size_t) nelem, (size_t) elsize); } -void * -irealloc(pointer, size) -void * const pointer; -const int size; +void *irealloc(void *pointer, const int size) { if (pointer == NULL) return imalloc(size); return realloc((void *) pointer, (size_t) nonzero(size)); } -char * -icatalloc(old, new) -char * const old; -const char * const new; +char *icatalloc(char *old, const char *new) { register char * result; register int oldsize, newsize; @@ -57,24 +41,18 @@ const char * const new; return result; } -char * -icpyalloc(string) -const char * const string; +char *icpyalloc(const char *string) { return icatalloc((char *) NULL, string); } -void -ifree(p) -char * const p; +void ifree(char *p) { if (p != NULL) (void) free(p); } -void -icfree(p) -char * const p; +void icfree(char *p) { if (p != NULL) (void) free(p); |