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

Commitc275499

Browse files
committed
Minor fixes for hstore_to_json_loose().
Fix unportable use of isdigit(), get rid of useless calculations.
1 parent4387cf9 commitc275499

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎contrib/hstore/hstore_io.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,8 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
12991299
* don't treat something with a leading zero followed by another
13001300
* digit as numeric - could be a zip code or similar
13011301
*/
1302-
if (src->len>0&& (src->data[0]!='0'|| !isdigit(src->data[1]))&&
1302+
if (src->len>0&&
1303+
!(src->data[0]=='0'&&isdigit((unsignedchar)src->data[1]))&&
13031304
strspn(src->data,"+-0123456789Ee.")==src->len)
13041305
{
13051306
/*
@@ -1308,7 +1309,7 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
13081309
*/
13091310
char*endptr="junk";
13101311

1311-
(void)(strtol(src->data,&endptr,10)+1);
1312+
(void)strtol(src->data,&endptr,10);
13121313
if (*endptr=='\0')
13131314
{
13141315
/*
@@ -1320,7 +1321,7 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
13201321
else
13211322
{
13221323
/* not an int - try a double */
1323-
(void)(strtod(src->data,&endptr)+1.0);
1324+
(void)strtod(src->data,&endptr);
13241325
if (*endptr=='\0')
13251326
is_number= true;
13261327
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp