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
243ee266
Commit
243ee266
authored
Jan 22, 2014
by
Andrew Dunstan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reindent json.c and jsonfuncs.c.
This will help in preparation of clean patches for upcoming json work.
parent
6c36f383
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
32 deletions
+35
-32
src/backend/utils/adt/json.c
src/backend/utils/adt/json.c
+35
-32
No files found.
src/backend/utils/adt/json.c
View file @
243ee266
...
@@ -751,11 +751,12 @@ json_lex_string(JsonLexContext *lex)
...
@@ -751,11 +751,12 @@ json_lex_string(JsonLexContext *lex)
report_json_context
(
lex
)));
report_json_context
(
lex
)));
/*
/*
* For UTF8, replace the escape sequence by the actual utf8
* For UTF8, replace the escape sequence by the actual
* character in lex->strval. Do this also for other encodings
* utf8 character in lex->strval. Do this also for other
* if the escape designates an ASCII character, otherwise
* encodings if the escape designates an ASCII character,
* raise an error. We don't ever unescape a \u0000, since that
* otherwise raise an error. We don't ever unescape a
* would result in an impermissible nul byte.
* \u0000, since that would result in an impermissible nul
* byte.
*/
*/
if
(
ch
==
0
)
if
(
ch
==
0
)
...
@@ -771,8 +772,9 @@ json_lex_string(JsonLexContext *lex)
...
@@ -771,8 +772,9 @@ json_lex_string(JsonLexContext *lex)
else
if
(
ch
<=
0x007f
)
else
if
(
ch
<=
0x007f
)
{
{
/*
/*
* This is the only way to designate things like a form feed
* This is the only way to designate things like a
* character in JSON, so it's useful in all encodings.
* form feed character in JSON, so it's useful in all
* encodings.
*/
*/
appendStringInfoChar
(
lex
->
strval
,
(
char
)
ch
);
appendStringInfoChar
(
lex
->
strval
,
(
char
)
ch
);
}
}
...
@@ -1246,13 +1248,14 @@ datum_to_json(Datum val, bool is_null, StringInfo result,
...
@@ -1246,13 +1248,14 @@ datum_to_json(Datum val, bool is_null, StringInfo result,
break
;
break
;
case
TYPCATEGORY_NUMERIC
:
case
TYPCATEGORY_NUMERIC
:
outputstr
=
OidOutputFunctionCall
(
typoutputfunc
,
val
);
outputstr
=
OidOutputFunctionCall
(
typoutputfunc
,
val
);
/*
/*
* Don't call escape_json here if it's a valid JSON number.
* Don't call escape_json here if it's a valid JSON number.
*/
*/
dummy_lex
.
input
=
*
outputstr
==
'-'
?
outputstr
+
1
:
outputstr
;
dummy_lex
.
input
=
*
outputstr
==
'-'
?
outputstr
+
1
:
outputstr
;
dummy_lex
.
input_length
=
strlen
(
dummy_lex
.
input
);
dummy_lex
.
input_length
=
strlen
(
dummy_lex
.
input
);
json_lex_number
(
&
dummy_lex
,
dummy_lex
.
input
,
&
numeric_error
);
json_lex_number
(
&
dummy_lex
,
dummy_lex
.
input
,
&
numeric_error
);
if
(
!
numeric_error
)
if
(
!
numeric_error
)
appendStringInfoString
(
result
,
outputstr
);
appendStringInfoString
(
result
,
outputstr
);
else
else
escape_json
(
result
,
outputstr
);
escape_json
(
result
,
outputstr
);
...
...
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