Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b31a9d7

Browse files
committed
Suppress compiler warning about no function return value.
Compilers that don't know that ereport(ERROR) doesn't return complained about the new coding in scanint8() introduced by commit 101c7ee. Tweak coding to avoid the warning. Per buildfarm.
1 parent c04d35f commit b31a9d7

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/backend/utils/adt/int8.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ scanint8(const char *str, bool errorOK, int64 *result)
8181

8282
/* require at least one digit */
8383
if (unlikely(!isdigit((unsigned char) *ptr)))
84-
{
8584
goto invalid_syntax;
86-
}
8785

8886
/* process digits */
8987
while (*ptr && isdigit((unsigned char) *ptr))
@@ -108,26 +106,25 @@ scanint8(const char *str, bool errorOK, int64 *result)
108106
goto out_of_range;
109107
tmp = -tmp;
110108
}
111-
*result = tmp;
112109

110+
*result = tmp;
113111
return true;
114112

115113
out_of_range:
116-
if (errorOK)
117-
return false;
118-
else
114+
if (!errorOK)
119115
ereport(ERROR,
120116
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
121117
errmsg("value \"%s\" is out of range for type %s",
122118
str, "bigint")));
119+
return false;
120+
123121
invalid_syntax:
124-
if (errorOK)
125-
return false;
126-
else
122+
if (!errorOK)
127123
ereport(ERROR,
128124
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
129125
errmsg("invalid input syntax for integer: \"%s\"",
130126
str)));
127+
return false;
131128
}
132129

133130
/* int8in()

0 commit comments

Comments
 (0)