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
30c0c4bf
Commit
30c0c4bf
authored
Dec 22, 2015
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary escaping in C character literals
'\"' is more commonly written simply as '"'.
parent
6efbded6
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
22 additions
and
22 deletions
+22
-22
src/backend/nodes/outfuncs.c
src/backend/nodes/outfuncs.c
+1
-1
src/backend/nodes/read.c
src/backend/nodes/read.c
+1
-1
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/arrayfuncs.c
+2
-2
src/backend/utils/adt/json.c
src/backend/utils/adt/json.c
+2
-2
src/backend/utils/adt/rangetypes.c
src/backend/utils/adt/rangetypes.c
+2
-2
src/backend/utils/adt/rowtypes.c
src/backend/utils/adt/rowtypes.c
+2
-2
src/backend/utils/adt/varlena.c
src/backend/utils/adt/varlena.c
+6
-6
src/bin/pg_dump/dumputils.c
src/bin/pg_dump/dumputils.c
+4
-4
src/interfaces/ecpg/preproc/output.c
src/interfaces/ecpg/preproc/output.c
+2
-2
No files found.
src/backend/nodes/outfuncs.c
View file @
30c0c4bf
...
@@ -124,7 +124,7 @@ _outToken(StringInfo str, const char *s)
...
@@ -124,7 +124,7 @@ _outToken(StringInfo str, const char *s)
*/
*/
/* These characters only need to be quoted at the start of the string */
/* These characters only need to be quoted at the start of the string */
if
(
*
s
==
'<'
||
if
(
*
s
==
'<'
||
*
s
==
'
\
"'
||
*
s
==
'"'
||
isdigit
((
unsigned
char
)
*
s
)
||
isdigit
((
unsigned
char
)
*
s
)
||
((
*
s
==
'+'
||
*
s
==
'-'
)
&&
((
*
s
==
'+'
||
*
s
==
'-'
)
&&
(
isdigit
((
unsigned
char
)
s
[
1
])
||
s
[
1
]
==
'.'
)))
(
isdigit
((
unsigned
char
)
s
[
1
])
||
s
[
1
]
==
'.'
)))
...
...
src/backend/nodes/read.c
View file @
30c0c4bf
...
@@ -245,7 +245,7 @@ nodeTokenType(char *token, int length)
...
@@ -245,7 +245,7 @@ nodeTokenType(char *token, int length)
retval
=
RIGHT_PAREN
;
retval
=
RIGHT_PAREN
;
else
if
(
*
token
==
'{'
)
else
if
(
*
token
==
'{'
)
retval
=
LEFT_BRACE
;
retval
=
LEFT_BRACE
;
else
if
(
*
token
==
'
\"'
&&
length
>
1
&&
token
[
length
-
1
]
==
'\
"'
)
else
if
(
*
token
==
'
"'
&&
length
>
1
&&
token
[
length
-
1
]
==
'
"'
)
retval
=
T_String
;
retval
=
T_String
;
else
if
(
*
token
==
'b'
)
else
if
(
*
token
==
'b'
)
retval
=
T_BitString
;
retval
=
T_BitString
;
...
...
src/backend/utils/adt/arrayfuncs.c
View file @
30c0c4bf
...
@@ -515,7 +515,7 @@ ArrayCount(const char *str, int *dim, char typdelim)
...
@@ -515,7 +515,7 @@ ArrayCount(const char *str, int *dim, char typdelim)
errmsg
(
"malformed array literal:
\"
%s
\"
"
,
str
),
errmsg
(
"malformed array literal:
\"
%s
\"
"
,
str
),
errdetail
(
"Unexpected end of input."
)));
errdetail
(
"Unexpected end of input."
)));
break
;
break
;
case
'
\
"'
:
case
'"'
:
/*
/*
* A quote must be after a level start, after a quoted
* A quote must be after a level start, after a quoted
...
@@ -799,7 +799,7 @@ ReadArrayStr(char *arrayStr,
...
@@ -799,7 +799,7 @@ ReadArrayStr(char *arrayStr,
dstendptr
=
dstptr
;
dstendptr
=
dstptr
;
hasquoting
=
true
;
/* can't be a NULL marker */
hasquoting
=
true
;
/* can't be a NULL marker */
break
;
break
;
case
'
\
"'
:
case
'"'
:
in_quotes
=
!
in_quotes
;
in_quotes
=
!
in_quotes
;
if
(
in_quotes
)
if
(
in_quotes
)
leadingspace
=
false
;
leadingspace
=
false
;
...
...
src/backend/utils/adt/json.c
View file @
30c0c4bf
...
@@ -2415,7 +2415,7 @@ escape_json(StringInfo buf, const char *str)
...
@@ -2415,7 +2415,7 @@ escape_json(StringInfo buf, const char *str)
{
{
const
char
*
p
;
const
char
*
p
;
appendStringInfoCharMacro
(
buf
,
'
\
"'
);
appendStringInfoCharMacro
(
buf
,
'"'
);
for
(
p
=
str
;
*
p
;
p
++
)
for
(
p
=
str
;
*
p
;
p
++
)
{
{
switch
(
*
p
)
switch
(
*
p
)
...
@@ -2449,7 +2449,7 @@ escape_json(StringInfo buf, const char *str)
...
@@ -2449,7 +2449,7 @@ escape_json(StringInfo buf, const char *str)
break
;
break
;
}
}
}
}
appendStringInfoCharMacro
(
buf
,
'
\
"'
);
appendStringInfoCharMacro
(
buf
,
'"'
);
}
}
/*
/*
...
...
src/backend/utils/adt/rangetypes.c
View file @
30c0c4bf
...
@@ -2132,11 +2132,11 @@ range_parse_bound(const char *string, const char *ptr,
...
@@ -2132,11 +2132,11 @@ range_parse_bound(const char *string, const char *ptr,
errdetail
(
"Unexpected end of input."
)));
errdetail
(
"Unexpected end of input."
)));
appendStringInfoChar
(
&
buf
,
*
ptr
++
);
appendStringInfoChar
(
&
buf
,
*
ptr
++
);
}
}
else
if
(
ch
==
'
\
"'
)
else
if
(
ch
==
'"'
)
{
{
if
(
!
inquote
)
if
(
!
inquote
)
inquote
=
true
;
inquote
=
true
;
else
if
(
*
ptr
==
'
\
"'
)
else
if
(
*
ptr
==
'"'
)
{
{
/* doubled quote within quote sequence */
/* doubled quote within quote sequence */
appendStringInfoChar
(
&
buf
,
*
ptr
++
);
appendStringInfoChar
(
&
buf
,
*
ptr
++
);
...
...
src/backend/utils/adt/rowtypes.c
View file @
30c0c4bf
...
@@ -216,11 +216,11 @@ record_in(PG_FUNCTION_ARGS)
...
@@ -216,11 +216,11 @@ record_in(PG_FUNCTION_ARGS)
errdetail
(
"Unexpected end of input."
)));
errdetail
(
"Unexpected end of input."
)));
appendStringInfoChar
(
&
buf
,
*
ptr
++
);
appendStringInfoChar
(
&
buf
,
*
ptr
++
);
}
}
else
if
(
ch
==
'
\
"'
)
else
if
(
ch
==
'"'
)
{
{
if
(
!
inquote
)
if
(
!
inquote
)
inquote
=
true
;
inquote
=
true
;
else
if
(
*
ptr
==
'
\
"'
)
else
if
(
*
ptr
==
'"'
)
{
{
/* doubled quote within quote sequence */
/* doubled quote within quote sequence */
appendStringInfoChar
(
&
buf
,
*
ptr
++
);
appendStringInfoChar
(
&
buf
,
*
ptr
++
);
...
...
src/backend/utils/adt/varlena.c
View file @
30c0c4bf
...
@@ -3007,16 +3007,16 @@ SplitIdentifierString(char *rawstring, char separator,
...
@@ -3007,16 +3007,16 @@ SplitIdentifierString(char *rawstring, char separator,
char
*
curname
;
char
*
curname
;
char
*
endp
;
char
*
endp
;
if
(
*
nextp
==
'
\
"'
)
if
(
*
nextp
==
'"'
)
{
{
/* Quoted name --- collapse quote-quote pairs, no downcasing */
/* Quoted name --- collapse quote-quote pairs, no downcasing */
curname
=
nextp
+
1
;
curname
=
nextp
+
1
;
for
(;;)
for
(;;)
{
{
endp
=
strchr
(
nextp
+
1
,
'
\
"'
);
endp
=
strchr
(
nextp
+
1
,
'"'
);
if
(
endp
==
NULL
)
if
(
endp
==
NULL
)
return
false
;
/* mismatched quotes */
return
false
;
/* mismatched quotes */
if
(
endp
[
1
]
!=
'
\
"'
)
if
(
endp
[
1
]
!=
'"'
)
break
;
/* found end of quoted name */
break
;
/* found end of quoted name */
/* Collapse adjacent quotes into one quote, and look again */
/* Collapse adjacent quotes into one quote, and look again */
memmove
(
endp
,
endp
+
1
,
strlen
(
endp
));
memmove
(
endp
,
endp
+
1
,
strlen
(
endp
));
...
@@ -3132,16 +3132,16 @@ SplitDirectoriesString(char *rawstring, char separator,
...
@@ -3132,16 +3132,16 @@ SplitDirectoriesString(char *rawstring, char separator,
char
*
curname
;
char
*
curname
;
char
*
endp
;
char
*
endp
;
if
(
*
nextp
==
'
\
"'
)
if
(
*
nextp
==
'"'
)
{
{
/* Quoted name --- collapse quote-quote pairs */
/* Quoted name --- collapse quote-quote pairs */
curname
=
nextp
+
1
;
curname
=
nextp
+
1
;
for
(;;)
for
(;;)
{
{
endp
=
strchr
(
nextp
+
1
,
'
\
"'
);
endp
=
strchr
(
nextp
+
1
,
'"'
);
if
(
endp
==
NULL
)
if
(
endp
==
NULL
)
return
false
;
/* mismatched quotes */
return
false
;
/* mismatched quotes */
if
(
endp
[
1
]
!=
'
\
"'
)
if
(
endp
[
1
]
!=
'"'
)
break
;
/* found end of quoted name */
break
;
/* found end of quoted name */
/* Collapse adjacent quotes into one quote, and look again */
/* Collapse adjacent quotes into one quote, and look again */
memmove
(
endp
,
endp
+
1
,
strlen
(
endp
));
memmove
(
endp
,
endp
+
1
,
strlen
(
endp
));
...
...
src/bin/pg_dump/dumputils.c
View file @
30c0c4bf
...
@@ -130,7 +130,7 @@ fmtId(const char *rawid)
...
@@ -130,7 +130,7 @@ fmtId(const char *rawid)
}
}
else
else
{
{
appendPQExpBufferChar
(
id_return
,
'
\
"'
);
appendPQExpBufferChar
(
id_return
,
'"'
);
for
(
cp
=
rawid
;
*
cp
;
cp
++
)
for
(
cp
=
rawid
;
*
cp
;
cp
++
)
{
{
/*
/*
...
@@ -138,11 +138,11 @@ fmtId(const char *rawid)
...
@@ -138,11 +138,11 @@ fmtId(const char *rawid)
* double double-quote per SQL99. Before, we put in a
* double double-quote per SQL99. Before, we put in a
* backslash/double-quote pair. - thomas 2000-08-05
* backslash/double-quote pair. - thomas 2000-08-05
*/
*/
if
(
*
cp
==
'
\
"'
)
if
(
*
cp
==
'"'
)
appendPQExpBufferChar
(
id_return
,
'
\
"'
);
appendPQExpBufferChar
(
id_return
,
'"'
);
appendPQExpBufferChar
(
id_return
,
*
cp
);
appendPQExpBufferChar
(
id_return
,
*
cp
);
}
}
appendPQExpBufferChar
(
id_return
,
'
\
"'
);
appendPQExpBufferChar
(
id_return
,
'"'
);
}
}
return
id_return
->
data
;
return
id_return
->
data
;
...
...
src/interfaces/ecpg/preproc/output.c
View file @
30c0c4bf
...
@@ -197,7 +197,7 @@ output_escaped_str(char *str, bool quoted)
...
@@ -197,7 +197,7 @@ output_escaped_str(char *str, bool quoted)
int
i
=
0
;
int
i
=
0
;
int
len
=
strlen
(
str
);
int
len
=
strlen
(
str
);
if
(
quoted
&&
str
[
0
]
==
'
\"'
&&
str
[
len
-
1
]
==
'\
"'
)
/* do not escape quotes
if
(
quoted
&&
str
[
0
]
==
'
"'
&&
str
[
len
-
1
]
==
'
"'
)
/* do not escape quotes
* at beginning and end
* at beginning and end
* if quoted string */
* if quoted string */
{
{
...
@@ -241,6 +241,6 @@ output_escaped_str(char *str, bool quoted)
...
@@ -241,6 +241,6 @@ output_escaped_str(char *str, bool quoted)
fputc
(
str
[
i
],
yyout
);
fputc
(
str
[
i
],
yyout
);
}
}
if
(
quoted
&&
str
[
0
]
==
'
\"'
&&
str
[
len
]
==
'\
"'
)
if
(
quoted
&&
str
[
0
]
==
'
"'
&&
str
[
len
]
==
'
"'
)
fputs
(
"
\"
"
,
yyout
);
fputs
(
"
\"
"
,
yyout
);
}
}
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