Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
cf171317
Commit
cf171317
authored
Dec 02, 2005
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove comment on errno=0 lines, but add mention to port/strtol.c function.
parent
de1dfc12
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
26 deletions
+35
-26
src/backend/utils/adt/datetime.c
src/backend/utils/adt/datetime.c
+11
-11
src/backend/utils/adt/float.c
src/backend/utils/adt/float.c
+13
-13
src/backend/utils/adt/numutils.c
src/backend/utils/adt/numutils.c
+2
-2
src/port/strtol.c
src/port/strtol.c
+9
-0
No files found.
src/backend/utils/adt/datetime.c
View file @
cf171317
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.16
4 2005/12/01 21:11:58
momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.16
5 2005/12/02 02:49:11
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1013,7 +1013,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
...
@@ -1013,7 +1013,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
if
(
tzp
==
NULL
)
if
(
tzp
==
NULL
)
return
DTERR_BAD_FORMAT
;
return
DTERR_BAD_FORMAT
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
val
=
strtol
(
field
[
i
],
&
cp
,
10
);
val
=
strtol
(
field
[
i
],
&
cp
,
10
);
if
(
errno
==
ERANGE
)
if
(
errno
==
ERANGE
)
return
DTERR_FIELD_OVERFLOW
;
return
DTERR_FIELD_OVERFLOW
;
...
@@ -1161,7 +1161,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
...
@@ -1161,7 +1161,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
char
*
cp
;
char
*
cp
;
int
val
;
int
val
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
val
=
strtol
(
field
[
i
],
&
cp
,
10
);
val
=
strtol
(
field
[
i
],
&
cp
,
10
);
if
(
errno
==
ERANGE
)
if
(
errno
==
ERANGE
)
return
DTERR_FIELD_OVERFLOW
;
return
DTERR_FIELD_OVERFLOW
;
...
@@ -1921,7 +1921,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
...
@@ -1921,7 +1921,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
break
;
break
;
}
}
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
val
=
strtol
(
field
[
i
],
&
cp
,
10
);
val
=
strtol
(
field
[
i
],
&
cp
,
10
);
if
(
errno
==
ERANGE
)
if
(
errno
==
ERANGE
)
return
DTERR_FIELD_OVERFLOW
;
return
DTERR_FIELD_OVERFLOW
;
...
@@ -2465,14 +2465,14 @@ DecodeTime(char *str, int fmask, int *tmask, struct pg_tm * tm, fsec_t *fsec)
...
@@ -2465,14 +2465,14 @@ DecodeTime(char *str, int fmask, int *tmask, struct pg_tm * tm, fsec_t *fsec)
*
tmask
=
DTK_TIME_M
;
*
tmask
=
DTK_TIME_M
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
tm
->
tm_hour
=
strtol
(
str
,
&
cp
,
10
);
tm
->
tm_hour
=
strtol
(
str
,
&
cp
,
10
);
if
(
errno
==
ERANGE
)
if
(
errno
==
ERANGE
)
return
DTERR_FIELD_OVERFLOW
;
return
DTERR_FIELD_OVERFLOW
;
if
(
*
cp
!=
':'
)
if
(
*
cp
!=
':'
)
return
DTERR_BAD_FORMAT
;
return
DTERR_BAD_FORMAT
;
str
=
cp
+
1
;
str
=
cp
+
1
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
tm
->
tm_min
=
strtol
(
str
,
&
cp
,
10
);
tm
->
tm_min
=
strtol
(
str
,
&
cp
,
10
);
if
(
errno
==
ERANGE
)
if
(
errno
==
ERANGE
)
return
DTERR_FIELD_OVERFLOW
;
return
DTERR_FIELD_OVERFLOW
;
...
@@ -2486,7 +2486,7 @@ DecodeTime(char *str, int fmask, int *tmask, struct pg_tm * tm, fsec_t *fsec)
...
@@ -2486,7 +2486,7 @@ DecodeTime(char *str, int fmask, int *tmask, struct pg_tm * tm, fsec_t *fsec)
else
else
{
{
str
=
cp
+
1
;
str
=
cp
+
1
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
tm
->
tm_sec
=
strtol
(
str
,
&
cp
,
10
);
tm
->
tm_sec
=
strtol
(
str
,
&
cp
,
10
);
if
(
errno
==
ERANGE
)
if
(
errno
==
ERANGE
)
return
DTERR_FIELD_OVERFLOW
;
return
DTERR_FIELD_OVERFLOW
;
...
@@ -2540,7 +2540,7 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
...
@@ -2540,7 +2540,7 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
*
tmask
=
0
;
*
tmask
=
0
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
val
=
strtol
(
str
,
&
cp
,
10
);
val
=
strtol
(
str
,
&
cp
,
10
);
if
(
errno
==
ERANGE
)
if
(
errno
==
ERANGE
)
return
DTERR_FIELD_OVERFLOW
;
return
DTERR_FIELD_OVERFLOW
;
...
@@ -2830,7 +2830,7 @@ DecodeTimezone(char *str, int *tzp)
...
@@ -2830,7 +2830,7 @@ DecodeTimezone(char *str, int *tzp)
if
(
*
str
!=
'+'
&&
*
str
!=
'-'
)
if
(
*
str
!=
'+'
&&
*
str
!=
'-'
)
return
DTERR_BAD_FORMAT
;
return
DTERR_BAD_FORMAT
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
hr
=
strtol
(
str
+
1
,
&
cp
,
10
);
hr
=
strtol
(
str
+
1
,
&
cp
,
10
);
if
(
errno
==
ERANGE
)
if
(
errno
==
ERANGE
)
return
DTERR_TZDISP_OVERFLOW
;
return
DTERR_TZDISP_OVERFLOW
;
...
@@ -2838,7 +2838,7 @@ DecodeTimezone(char *str, int *tzp)
...
@@ -2838,7 +2838,7 @@ DecodeTimezone(char *str, int *tzp)
/* explicit delimiter? */
/* explicit delimiter? */
if
(
*
cp
==
':'
)
if
(
*
cp
==
':'
)
{
{
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
min
=
strtol
(
cp
+
1
,
&
cp
,
10
);
min
=
strtol
(
cp
+
1
,
&
cp
,
10
);
if
(
errno
==
ERANGE
)
if
(
errno
==
ERANGE
)
return
DTERR_TZDISP_OVERFLOW
;
return
DTERR_TZDISP_OVERFLOW
;
...
@@ -3085,7 +3085,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct pg_tm * tm,
...
@@ -3085,7 +3085,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct pg_tm * tm,
case
DTK_DATE
:
case
DTK_DATE
:
case
DTK_NUMBER
:
case
DTK_NUMBER
:
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
val
=
strtol
(
field
[
i
],
&
cp
,
10
);
val
=
strtol
(
field
[
i
],
&
cp
,
10
);
if
(
errno
==
ERANGE
)
if
(
errno
==
ERANGE
)
return
DTERR_FIELD_OVERFLOW
;
return
DTERR_FIELD_OVERFLOW
;
...
...
src/backend/utils/adt/float.c
View file @
cf171317
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.11
8 2005/12/01 21:11:58
momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.11
9 2005/12/02 02:49:11
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -278,7 +278,7 @@ float4in(PG_FUNCTION_ARGS)
...
@@ -278,7 +278,7 @@ float4in(PG_FUNCTION_ARGS)
while
(
*
num
!=
'\0'
&&
isspace
((
unsigned
char
)
*
num
))
while
(
*
num
!=
'\0'
&&
isspace
((
unsigned
char
)
*
num
))
num
++
;
num
++
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
val
=
strtod
(
num
,
&
endptr
);
val
=
strtod
(
num
,
&
endptr
);
/* did we not see anything that looks like a double? */
/* did we not see anything that looks like a double? */
...
@@ -445,7 +445,7 @@ float8in(PG_FUNCTION_ARGS)
...
@@ -445,7 +445,7 @@ float8in(PG_FUNCTION_ARGS)
while
(
*
num
!=
'\0'
&&
isspace
((
unsigned
char
)
*
num
))
while
(
*
num
!=
'\0'
&&
isspace
((
unsigned
char
)
*
num
))
num
++
;
num
++
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
val
=
strtod
(
num
,
&
endptr
);
val
=
strtod
(
num
,
&
endptr
);
/* did we not see anything that looks like a double? */
/* did we not see anything that looks like a double? */
...
@@ -1476,7 +1476,7 @@ dpow(PG_FUNCTION_ARGS)
...
@@ -1476,7 +1476,7 @@ dpow(PG_FUNCTION_ARGS)
* We must check both for errno getting set and for a NaN result, in order
* We must check both for errno getting set and for a NaN result, in order
* to deal with the vagaries of different platforms...
* to deal with the vagaries of different platforms...
*/
*/
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
result
=
pow
(
arg1
,
arg2
);
result
=
pow
(
arg1
,
arg2
);
if
(
errno
!=
0
if
(
errno
!=
0
#ifdef HAVE_FINITE
#ifdef HAVE_FINITE
...
@@ -1506,7 +1506,7 @@ dexp(PG_FUNCTION_ARGS)
...
@@ -1506,7 +1506,7 @@ dexp(PG_FUNCTION_ARGS)
* to deal with the vagaries of different platforms. Also, a zero result
* to deal with the vagaries of different platforms. Also, a zero result
* implies unreported underflow.
* implies unreported underflow.
*/
*/
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
result
=
exp
(
arg1
);
result
=
exp
(
arg1
);
if
(
errno
!=
0
||
result
==
0
.
0
if
(
errno
!=
0
||
result
==
0
.
0
#ifdef HAVE_FINITE
#ifdef HAVE_FINITE
...
@@ -1590,7 +1590,7 @@ dacos(PG_FUNCTION_ARGS)
...
@@ -1590,7 +1590,7 @@ dacos(PG_FUNCTION_ARGS)
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
result
;
float8
result
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
result
=
acos
(
arg1
);
result
=
acos
(
arg1
);
if
(
errno
!=
0
if
(
errno
!=
0
#ifdef HAVE_FINITE
#ifdef HAVE_FINITE
...
@@ -1615,7 +1615,7 @@ dasin(PG_FUNCTION_ARGS)
...
@@ -1615,7 +1615,7 @@ dasin(PG_FUNCTION_ARGS)
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
result
;
float8
result
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
result
=
asin
(
arg1
);
result
=
asin
(
arg1
);
if
(
errno
!=
0
if
(
errno
!=
0
#ifdef HAVE_FINITE
#ifdef HAVE_FINITE
...
@@ -1640,7 +1640,7 @@ datan(PG_FUNCTION_ARGS)
...
@@ -1640,7 +1640,7 @@ datan(PG_FUNCTION_ARGS)
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
result
;
float8
result
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
result
=
atan
(
arg1
);
result
=
atan
(
arg1
);
if
(
errno
!=
0
if
(
errno
!=
0
#ifdef HAVE_FINITE
#ifdef HAVE_FINITE
...
@@ -1666,7 +1666,7 @@ datan2(PG_FUNCTION_ARGS)
...
@@ -1666,7 +1666,7 @@ datan2(PG_FUNCTION_ARGS)
float8
arg2
=
PG_GETARG_FLOAT8
(
1
);
float8
arg2
=
PG_GETARG_FLOAT8
(
1
);
float8
result
;
float8
result
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
result
=
atan2
(
arg1
,
arg2
);
result
=
atan2
(
arg1
,
arg2
);
if
(
errno
!=
0
if
(
errno
!=
0
#ifdef HAVE_FINITE
#ifdef HAVE_FINITE
...
@@ -1691,7 +1691,7 @@ dcos(PG_FUNCTION_ARGS)
...
@@ -1691,7 +1691,7 @@ dcos(PG_FUNCTION_ARGS)
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
result
;
float8
result
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
result
=
cos
(
arg1
);
result
=
cos
(
arg1
);
if
(
errno
!=
0
if
(
errno
!=
0
#ifdef HAVE_FINITE
#ifdef HAVE_FINITE
...
@@ -1716,7 +1716,7 @@ dcot(PG_FUNCTION_ARGS)
...
@@ -1716,7 +1716,7 @@ dcot(PG_FUNCTION_ARGS)
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
result
;
float8
result
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
result
=
tan
(
arg1
);
result
=
tan
(
arg1
);
if
(
errno
!=
0
||
result
==
0
.
0
if
(
errno
!=
0
||
result
==
0
.
0
#ifdef HAVE_FINITE
#ifdef HAVE_FINITE
...
@@ -1742,7 +1742,7 @@ dsin(PG_FUNCTION_ARGS)
...
@@ -1742,7 +1742,7 @@ dsin(PG_FUNCTION_ARGS)
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
result
;
float8
result
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
result
=
sin
(
arg1
);
result
=
sin
(
arg1
);
if
(
errno
!=
0
if
(
errno
!=
0
#ifdef HAVE_FINITE
#ifdef HAVE_FINITE
...
@@ -1767,7 +1767,7 @@ dtan(PG_FUNCTION_ARGS)
...
@@ -1767,7 +1767,7 @@ dtan(PG_FUNCTION_ARGS)
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
arg1
=
PG_GETARG_FLOAT8
(
0
);
float8
result
;
float8
result
;
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
result
=
tan
(
arg1
);
result
=
tan
(
arg1
);
if
(
errno
!=
0
if
(
errno
!=
0
#ifdef HAVE_FINITE
#ifdef HAVE_FINITE
...
...
src/backend/utils/adt/numutils.c
View file @
cf171317
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/numutils.c,v 1.7
1 2005/12/01 21:16:13
momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/numutils.c,v 1.7
2 2005/12/02 02:49:11
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -73,7 +73,7 @@ pg_atoi(char *s, int size, int c)
...
@@ -73,7 +73,7 @@ pg_atoi(char *s, int size, int c)
errmsg
(
"invalid input syntax for integer:
\"
%s
\"
"
,
errmsg
(
"invalid input syntax for integer:
\"
%s
\"
"
,
s
)));
s
)));
errno
=
0
;
/* avoid having to check the result for failure */
errno
=
0
;
l
=
strtol
(
s
,
&
badp
,
10
);
l
=
strtol
(
s
,
&
badp
,
10
);
/* We made no progress parsing the string, so bail out */
/* We made no progress parsing the string, so bail out */
...
...
src/port/strtol.c
View file @
cf171317
...
@@ -44,6 +44,15 @@ static char sccsid[] = "@(#)strtol.c 5.4 (Berkeley) 2/23/91";
...
@@ -44,6 +44,15 @@ static char sccsid[] = "@(#)strtol.c 5.4 (Berkeley) 2/23/91";
#define const
#define const
/*
* Usage Tip:
*
* strtol() doesn't give a unique return value to indicate that errno
* should be consulted, so in most cases it is best to set errno = 0
* before calling this function, and then errno != 0 can be tested
* after the function completes.
*/
/*
/*
* Convert a string to a long integer.
* Convert a string to a long integer.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment