Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
c2754991
Commit
c2754991
authored
12 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Minor fixes for hstore_to_json_loose().
Fix unportable use of isdigit(), get rid of useless calculations.
parent
4387cf95
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/hstore/hstore_io.c
+4
-3
4 additions, 3 deletions
contrib/hstore/hstore_io.c
with
4 additions
and
3 deletions
contrib/hstore/hstore_io.c
+
4
−
3
View file @
c2754991
...
...
@@ -1299,7 +1299,8 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
* don't treat something with a leading zero followed by another
* digit as numeric - could be a zip code or similar
*/
if
(
src
->
len
>
0
&&
(
src
->
data
[
0
]
!=
'0'
||
!
isdigit
(
src
->
data
[
1
]))
&&
if
(
src
->
len
>
0
&&
!
(
src
->
data
[
0
]
==
'0'
&&
isdigit
((
unsigned
char
)
src
->
data
[
1
]))
&&
strspn
(
src
->
data
,
"+-0123456789Ee."
)
==
src
->
len
)
{
/*
...
...
@@ -1308,7 +1309,7 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
*/
char
*
endptr
=
"junk"
;
(
void
)
(
strtol
(
src
->
data
,
&
endptr
,
10
)
+
1
)
;
(
void
)
strtol
(
src
->
data
,
&
endptr
,
10
);
if
(
*
endptr
==
'\0'
)
{
/*
...
...
@@ -1320,7 +1321,7 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
else
{
/* not an int - try a double */
(
void
)
(
strtod
(
src
->
data
,
&
endptr
)
+
1
.
0
)
;
(
void
)
strtod
(
src
->
data
,
&
endptr
);
if
(
*
endptr
==
'\0'
)
is_number
=
true
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment