1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

Rename strtoi() to strtoint().

NetBSD has seen fit to invent a libc function named strtoi(), which
conflicts with the long-established static functions of the same name in
datetime.c and ecpg's interval.c.  While muttering darkly about intrusions
on application namespace, we'll rename our functions to avoid the conflict.

Back-patch to all supported branches, since this would affect attempts
to build any of them on recent NetBSD.

Thomas Munro
This commit is contained in:
Tom Lane
2016-04-23 16:53:15 -04:00
parent b87b2f4bda
commit 0ab3595e5b
2 changed files with 17 additions and 17 deletions

View File

@ -16,7 +16,7 @@
/* copy&pasted from .../src/backend/utils/adt/datetime.c */
static int
strtoi(const char *nptr, char **endptr, int base)
strtoint(const char *nptr, char **endptr, int base)
{
long val;
@ -448,7 +448,7 @@ DecodeInterval(char **field, int *ftype, int nf, /* int range, */
}
errno = 0;
val = strtoi(field[i], &cp, 10);
val = strtoint(field[i], &cp, 10);
if (errno == ERANGE)
return DTERR_FIELD_OVERFLOW;
@ -457,7 +457,7 @@ DecodeInterval(char **field, int *ftype, int nf, /* int range, */
/* SQL "years-months" syntax */
int val2;
val2 = strtoi(cp + 1, &cp, 10);
val2 = strtoint(cp + 1, &cp, 10);
if (errno == ERANGE || val2 < 0 || val2 >= MONTHS_PER_YEAR)
return DTERR_FIELD_OVERFLOW;
if (*cp != '\0')