Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit521e888

Browse files
committed
Undo an unadvertised change in the API of pg_atoi. In all previous
releases, a nonzero 'c' argument meant that the input string could beterminated by either that character or \0. Recent refactoring brokethat, causing the thing to scan for 'c' only. This went undetectedbecause no part of the main code actually passes nonzero 'c'. Howeverit broke tsearch2 and possibly other user-written code that assumedthe old definition. Per report from Tom Hebbron.
1 parent0471cd5 commit521e888

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎src/backend/utils/adt/numutils.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/adt/numutils.c,v 1.67 2004/12/31 22:01:22 pgsql Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/adt/numutils.c,v 1.68 2005/01/09 21:03:19 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -46,12 +46,12 @@
4646
/*
4747
* pg_atoi: convert string to integer
4848
*
49-
* 'size' is the sizeof() the desired integral result (1, 2, or 4 bytes).
50-
*
5149
* allows any number of leading or trailing whitespace characters.
5250
*
53-
* 'c' is the character that terminates the input string (after any
54-
* number of whitespace characters).
51+
* 'size' is the sizeof() the desired integral result (1, 2, or 4 bytes).
52+
*
53+
* c, if not 0, is a terminator character that may appear after the
54+
* integer (plus whitespace). If 0, the string must end after the integer.
5555
*
5656
* Unlike plain atoi(), this will throw ereport() upon bad input format or
5757
* overflow.
@@ -88,10 +88,10 @@ pg_atoi(char *s, int size, int c)
8888
* Skip any trailing whitespace; if anything but whitespace remains
8989
* before the terminating character, bail out
9090
*/
91-
while (*badp!=c&&isspace((unsignedchar)*badp))
91+
while (*badp&&*badp!=c&&isspace((unsignedchar)*badp))
9292
badp++;
9393

94-
if (*badp!=c)
94+
if (*badp&&*badp!=c)
9595
ereport(ERROR,
9696
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
9797
errmsg("invalid input syntax for integer: \"%s\"",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp