mirror of https://github.com/postgres/postgres
We hadn't done this in about six years, which proves to have been a mistake because there's been a lot of code churn upstream, making the merge rather painful. But putting it off any further isn't going to lessen the pain, and there are at least two incompatible changes that we need to absorb before someone starts complaining that --with-system-tzdata doesn't work at all on their platform, or we get blindsided by a tzdata release that our out-of-date zic can't compile. Last week's "time zone abbreviation differs from POSIX standard" mess was a wake-up call in that regard. This is a sufficiently large patch that I'm afraid to back-patch it immediately, though the foregoing considerations imply that we probably should do so eventually. For the moment, just put it in HEAD so that it can get some testing. Maybe we can wait till the end of the 9.6 beta cycle before deeming it okay.pull/11/head
parent
e5a4dea80f
commit
1c1a7cbd6a
@ -1,76 +0,0 @@ |
||||
/*
|
||||
* This file is in the public domain, so clarified as of |
||||
* 2006-07-17 by Arthur David Olson. |
||||
* |
||||
* IDENTIFICATION |
||||
* src/timezone/ialloc.c |
||||
*/ |
||||
|
||||
#include "postgres_fe.h" |
||||
|
||||
#include "private.h" |
||||
|
||||
|
||||
#define nonzero(n) (((n) == 0) ? 1 : (n)) |
||||
|
||||
char * |
||||
imalloc(int n) |
||||
{ |
||||
return malloc((size_t) nonzero(n)); |
||||
} |
||||
|
||||
char * |
||||
icalloc(int nelem, int elsize) |
||||
{ |
||||
if (nelem == 0 || elsize == 0) |
||||
nelem = elsize = 1; |
||||
return calloc((size_t) nelem, (size_t) elsize); |
||||
} |
||||
|
||||
void * |
||||
irealloc(void *pointer, int size) |
||||
{ |
||||
if (pointer == NULL) |
||||
return imalloc(size); |
||||
return realloc((void *) pointer, (size_t) nonzero(size)); |
||||
} |
||||
|
||||
char * |
||||
icatalloc(char *old, const char *new) |
||||
{ |
||||
char *result; |
||||
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 = irealloc(old, oldsize + newsize + 1)) != NULL) |
||||
if (new != NULL) |
||||
(void) strcpy(result + oldsize, new); |
||||
return result; |
||||
} |
||||
|
||||
char * |
||||
icpyalloc(const char *string) |
||||
{ |
||||
return icatalloc((char *) NULL, string); |
||||
} |
||||
|
||||
void |
||||
ifree(char *p) |
||||
{ |
||||
if (p != NULL) |
||||
(void) free(p); |
||||
} |
||||
|
||||
void |
||||
icfree(char *p) |
||||
{ |
||||
if (p != NULL) |
||||
(void) free(p); |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -1,62 +0,0 @@ |
||||
/*
|
||||
* This file is in the public domain, so clarified as of |
||||
* 2006-07-17 by Arthur David Olson. |
||||
* |
||||
* IDENTIFICATION |
||||
* src/timezone/scheck.c |
||||
*/ |
||||
|
||||
#include "postgres_fe.h" |
||||
|
||||
#include "private.h" |
||||
|
||||
|
||||
const char * |
||||
scheck(const char *string, const char *format) |
||||
{ |
||||
char *fbuf; |
||||
const char *fp; |
||||
char *tp; |
||||
int c; |
||||
const char *result; |
||||
char dummy; |
||||
|
||||
result = ""; |
||||
if (string == NULL || format == NULL) |
||||
return result; |
||||
fbuf = imalloc((int) (2 * strlen(format) + 4)); |
||||
if (fbuf == NULL) |
||||
return result; |
||||
fp = format; |
||||
tp = fbuf; |
||||
while ((*tp++ = c = *fp++) != '\0') |
||||
{ |
||||
if (c != '%') |
||||
continue; |
||||
if (*fp == '%') |
||||
{ |
||||
*tp++ = *fp++; |
||||
continue; |
||||
} |
||||
*tp++ = '*'; |
||||
if (*fp == '*') |
||||
++fp; |
||||
while (is_digit(*fp)) |
||||
*tp++ = *fp++; |
||||
if (*fp == 'l' || *fp == 'h') |
||||
*tp++ = *fp++; |
||||
else if (*fp == '[') |
||||
do |
||||
*tp++ = *fp++; |
||||
while (*fp != '\0' && *fp != ']'); |
||||
if ((*tp++ = *fp++) == '\0') |
||||
break; |
||||
} |
||||
*(tp - 1) = '%'; |
||||
*tp++ = 'c'; |
||||
*tp = '\0'; |
||||
if (sscanf(string, fbuf, &dummy) != 1) |
||||
result = (char *) format; |
||||
ifree(fbuf); |
||||
return result; |
||||
} |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue