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

Commit30c0c4b

Browse files
committed
Remove unnecessary escaping in C character literals
'\"' is more commonly written simply as '"'.
1 parent6efbded commit30c0c4b

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

‎src/backend/nodes/outfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ _outToken(StringInfo str, const char *s)
124124
*/
125125
/* These characters only need to be quoted at the start of the string */
126126
if (*s=='<'||
127-
*s=='\"'||
127+
*s=='"'||
128128
isdigit((unsignedchar)*s)||
129129
((*s=='+'||*s=='-')&&
130130
(isdigit((unsignedchar)s[1])||s[1]=='.')))

‎src/backend/nodes/read.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ nodeTokenType(char *token, int length)
245245
retval=RIGHT_PAREN;
246246
elseif (*token=='{')
247247
retval=LEFT_BRACE;
248-
elseif (*token=='\"'&&length>1&&token[length-1]=='\"')
248+
elseif (*token=='"'&&length>1&&token[length-1]=='"')
249249
retval=T_String;
250250
elseif (*token=='b')
251251
retval=T_BitString;

‎src/backend/utils/adt/arrayfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ ArrayCount(const char *str, int *dim, char typdelim)
515515
errmsg("malformed array literal: \"%s\"",str),
516516
errdetail("Unexpected end of input.")));
517517
break;
518-
case'\"':
518+
case'"':
519519

520520
/*
521521
* A quote must be after a level start, after a quoted
@@ -799,7 +799,7 @@ ReadArrayStr(char *arrayStr,
799799
dstendptr=dstptr;
800800
hasquoting= true;/* can't be a NULL marker */
801801
break;
802-
case'\"':
802+
case'"':
803803
in_quotes= !in_quotes;
804804
if (in_quotes)
805805
leadingspace= false;

‎src/backend/utils/adt/json.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,7 +2415,7 @@ escape_json(StringInfo buf, const char *str)
24152415
{
24162416
constchar*p;
24172417

2418-
appendStringInfoCharMacro(buf,'\"');
2418+
appendStringInfoCharMacro(buf,'"');
24192419
for (p=str;*p;p++)
24202420
{
24212421
switch (*p)
@@ -2449,7 +2449,7 @@ escape_json(StringInfo buf, const char *str)
24492449
break;
24502450
}
24512451
}
2452-
appendStringInfoCharMacro(buf,'\"');
2452+
appendStringInfoCharMacro(buf,'"');
24532453
}
24542454

24552455
/*

‎src/backend/utils/adt/rangetypes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,11 +2132,11 @@ range_parse_bound(const char *string, const char *ptr,
21322132
errdetail("Unexpected end of input.")));
21332133
appendStringInfoChar(&buf,*ptr++);
21342134
}
2135-
elseif (ch=='\"')
2135+
elseif (ch=='"')
21362136
{
21372137
if (!inquote)
21382138
inquote= true;
2139-
elseif (*ptr=='\"')
2139+
elseif (*ptr=='"')
21402140
{
21412141
/* doubled quote within quote sequence */
21422142
appendStringInfoChar(&buf,*ptr++);

‎src/backend/utils/adt/rowtypes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ record_in(PG_FUNCTION_ARGS)
216216
errdetail("Unexpected end of input.")));
217217
appendStringInfoChar(&buf,*ptr++);
218218
}
219-
elseif (ch=='\"')
219+
elseif (ch=='"')
220220
{
221221
if (!inquote)
222222
inquote= true;
223-
elseif (*ptr=='\"')
223+
elseif (*ptr=='"')
224224
{
225225
/* doubled quote within quote sequence */
226226
appendStringInfoChar(&buf,*ptr++);

‎src/backend/utils/adt/varlena.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3007,16 +3007,16 @@ SplitIdentifierString(char *rawstring, char separator,
30073007
char*curname;
30083008
char*endp;
30093009

3010-
if (*nextp=='\"')
3010+
if (*nextp=='"')
30113011
{
30123012
/* Quoted name --- collapse quote-quote pairs, no downcasing */
30133013
curname=nextp+1;
30143014
for (;;)
30153015
{
3016-
endp=strchr(nextp+1,'\"');
3016+
endp=strchr(nextp+1,'"');
30173017
if (endp==NULL)
30183018
return false;/* mismatched quotes */
3019-
if (endp[1]!='\"')
3019+
if (endp[1]!='"')
30203020
break;/* found end of quoted name */
30213021
/* Collapse adjacent quotes into one quote, and look again */
30223022
memmove(endp,endp+1,strlen(endp));
@@ -3132,16 +3132,16 @@ SplitDirectoriesString(char *rawstring, char separator,
31323132
char*curname;
31333133
char*endp;
31343134

3135-
if (*nextp=='\"')
3135+
if (*nextp=='"')
31363136
{
31373137
/* Quoted name --- collapse quote-quote pairs */
31383138
curname=nextp+1;
31393139
for (;;)
31403140
{
3141-
endp=strchr(nextp+1,'\"');
3141+
endp=strchr(nextp+1,'"');
31423142
if (endp==NULL)
31433143
return false;/* mismatched quotes */
3144-
if (endp[1]!='\"')
3144+
if (endp[1]!='"')
31453145
break;/* found end of quoted name */
31463146
/* Collapse adjacent quotes into one quote, and look again */
31473147
memmove(endp,endp+1,strlen(endp));

‎src/bin/pg_dump/dumputils.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,19 @@ fmtId(const char *rawid)
130130
}
131131
else
132132
{
133-
appendPQExpBufferChar(id_return,'\"');
133+
appendPQExpBufferChar(id_return,'"');
134134
for (cp=rawid;*cp;cp++)
135135
{
136136
/*
137137
* Did we find a double-quote in the string? Then make this a
138138
* double double-quote per SQL99. Before, we put in a
139139
* backslash/double-quote pair. - thomas 2000-08-05
140140
*/
141-
if (*cp=='\"')
142-
appendPQExpBufferChar(id_return,'\"');
141+
if (*cp=='"')
142+
appendPQExpBufferChar(id_return,'"');
143143
appendPQExpBufferChar(id_return,*cp);
144144
}
145-
appendPQExpBufferChar(id_return,'\"');
145+
appendPQExpBufferChar(id_return,'"');
146146
}
147147

148148
returnid_return->data;

‎src/interfaces/ecpg/preproc/output.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ output_escaped_str(char *str, bool quoted)
197197
inti=0;
198198
intlen=strlen(str);
199199

200-
if (quoted&&str[0]=='\"'&&str[len-1]=='\"')/* do not escape quotes
200+
if (quoted&&str[0]=='"'&&str[len-1]=='"')/* do not escape quotes
201201
* at beginning and end
202202
* if quoted string */
203203
{
@@ -241,6 +241,6 @@ output_escaped_str(char *str, bool quoted)
241241
fputc(str[i],yyout);
242242
}
243243

244-
if (quoted&&str[0]=='\"'&&str[len]=='\"')
244+
if (quoted&&str[0]=='"'&&str[len]=='"')
245245
fputs("\"",yyout);
246246
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp