Remove unnecessary escaping in C character literals
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 23 Dec 2015 03:43:46 +0000 (22:43 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 23 Dec 2015 03:43:46 +0000 (22:43 -0500)
'\"' is more commonly written simply as '"'.

src/backend/nodes/outfuncs.c
src/backend/nodes/read.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/json.c
src/backend/utils/adt/rangetypes.c
src/backend/utils/adt/rowtypes.c
src/backend/utils/adt/varlena.c
src/bin/pg_dump/dumputils.c
src/interfaces/ecpg/preproc/output.c

index fe2c643c34832248576a6aab6defed69a8491624..7169d46febd61d7ed7d89cf3ff55dcdcbafadc6a 100644 (file)
@@ -124,7 +124,7 @@ _outToken(StringInfo str, const char *s)
         */
        /* These characters only need to be quoted at the start of the string */
        if (*s == '<' ||
-               *s == '\"' ||
+               *s == '"' ||
                isdigit((unsigned char) *s) ||
                ((*s == '+' || *s == '-') &&
                 (isdigit((unsigned char) s[1]) || s[1] == '.')))
index 0dabfa7dc9bf4de21762b4bb4ba9e53a25e9b3cc..71d69ecd2584d1a3e330bf22d42f455201bee0d2 100644 (file)
@@ -245,7 +245,7 @@ nodeTokenType(char *token, int length)
                retval = RIGHT_PAREN;
        else if (*token == '{')
                retval = LEFT_BRACE;
-       else if (*token == '\"' && length > 1 && token[length - 1] == '\"')
+       else if (*token == '"' && length > 1 && token[length - 1] == '"')
                retval = T_String;
        else if (*token == 'b')
                retval = T_BitString;
index 359fb1462bc6ddb692051f1f691bc2a0b5723a32..72d308a59770ea7e5047b363b3b975107e384600 100644 (file)
@@ -515,7 +515,7 @@ ArrayCount(const char *str, int *dim, char typdelim)
                                                          errmsg("malformed array literal: \"%s\"", str),
                                                                 errdetail("Unexpected end of input.")));
                                        break;
-                               case '\"':
+                               case '"':
 
                                        /*
                                         * A quote must be after a level start, after a quoted
@@ -799,7 +799,7 @@ ReadArrayStr(char *arrayStr,
                                        dstendptr = dstptr;
                                        hasquoting = true;      /* can't be a NULL marker */
                                        break;
-                               case '\"':
+                               case '"':
                                        in_quotes = !in_quotes;
                                        if (in_quotes)
                                                leadingspace = false;
index af97fc1eff4cdbd5ac0989331c0d0601805d9f73..a54604ee9df1e4d6b2a83e84a67c194245752092 100644 (file)
@@ -2415,7 +2415,7 @@ escape_json(StringInfo buf, const char *str)
 {
        const char *p;
 
-       appendStringInfoCharMacro(buf, '\"');
+       appendStringInfoCharMacro(buf, '"');
        for (p = str; *p; p++)
        {
                switch (*p)
@@ -2449,7 +2449,7 @@ escape_json(StringInfo buf, const char *str)
                                break;
                }
        }
-       appendStringInfoCharMacro(buf, '\"');
+       appendStringInfoCharMacro(buf, '"');
 }
 
 /*
index 88f857b509f806f11c9e91dbb161b15c9a1969eb..21e386c279e7651847fadd43e1d49f3fbd3696f4 100644 (file)
@@ -2132,11 +2132,11 @@ range_parse_bound(const char *string, const char *ptr,
                                                         errdetail("Unexpected end of input.")));
                                appendStringInfoChar(&buf, *ptr++);
                        }
-                       else if (ch == '\"')
+                       else if (ch == '"')
                        {
                                if (!inquote)
                                        inquote = true;
-                               else if (*ptr == '\"')
+                               else if (*ptr == '"')
                                {
                                        /* doubled quote within quote sequence */
                                        appendStringInfoChar(&buf, *ptr++);
index e1c72a123245d8b03b59cc05d3e8c65a79f4e5bb..567622f759a1b85dafd8c4ab7794554d95d0f7ce 100644 (file)
@@ -216,11 +216,11 @@ record_in(PG_FUNCTION_ARGS)
                                                                 errdetail("Unexpected end of input.")));
                                        appendStringInfoChar(&buf, *ptr++);
                                }
-                               else if (ch == '\"')
+                               else if (ch == '"')
                                {
                                        if (!inquote)
                                                inquote = true;
-                                       else if (*ptr == '\"')
+                                       else if (*ptr == '"')
                                        {
                                                /* doubled quote within quote sequence */
                                                appendStringInfoChar(&buf, *ptr++);
index a89f586abad5531c78771ac63bdccefbb4ec2926..85f85d430e01b9521e4dd28fb86d7e59385f6c16 100644 (file)
@@ -3007,16 +3007,16 @@ SplitIdentifierString(char *rawstring, char separator,
                char       *curname;
                char       *endp;
 
-               if (*nextp == '\"')
+               if (*nextp == '"')
                {
                        /* Quoted name --- collapse quote-quote pairs, no downcasing */
                        curname = nextp + 1;
                        for (;;)
                        {
-                               endp = strchr(nextp + 1, '\"');
+                               endp = strchr(nextp + 1, '"');
                                if (endp == NULL)
                                        return false;           /* mismatched quotes */
-                               if (endp[1] != '\"')
+                               if (endp[1] != '"')
                                        break;          /* found end of quoted name */
                                /* Collapse adjacent quotes into one quote, and look again */
                                memmove(endp, endp + 1, strlen(endp));
@@ -3132,16 +3132,16 @@ SplitDirectoriesString(char *rawstring, char separator,
                char       *curname;
                char       *endp;
 
-               if (*nextp == '\"')
+               if (*nextp == '"')
                {
                        /* Quoted name --- collapse quote-quote pairs */
                        curname = nextp + 1;
                        for (;;)
                        {
-                               endp = strchr(nextp + 1, '\"');
+                               endp = strchr(nextp + 1, '"');
                                if (endp == NULL)
                                        return false;           /* mismatched quotes */
-                               if (endp[1] != '\"')
+                               if (endp[1] != '"')
                                        break;          /* found end of quoted name */
                                /* Collapse adjacent quotes into one quote, and look again */
                                memmove(endp, endp + 1, strlen(endp));
index 52b2b98ed0ef74655b1df3746b110772f27b54cd..da82af25d369b9eb6f72c40206ac1902d1354555 100644 (file)
@@ -130,7 +130,7 @@ fmtId(const char *rawid)
        }
        else
        {
-               appendPQExpBufferChar(id_return, '\"');
+               appendPQExpBufferChar(id_return, '"');
                for (cp = rawid; *cp; cp++)
                {
                        /*
@@ -138,11 +138,11 @@ fmtId(const char *rawid)
                         * double double-quote per SQL99. Before, we put in a
                         * backslash/double-quote pair. - thomas 2000-08-05
                         */
-                       if (*cp == '\"')
-                               appendPQExpBufferChar(id_return, '\"');
+                       if (*cp == '"')
+                               appendPQExpBufferChar(id_return, '"');
                        appendPQExpBufferChar(id_return, *cp);
                }
-               appendPQExpBufferChar(id_return, '\"');
+               appendPQExpBufferChar(id_return, '"');
        }
 
        return id_return->data;
index 8cac947b5a3764acb033445d9e9a439f5856d228..cf2ed58d0ac14a0904c2c4794a4cc14f9072a4d5 100644 (file)
@@ -197,7 +197,7 @@ output_escaped_str(char *str, bool quoted)
        int                     i = 0;
        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
                                                                                                                                 * if quoted string */
        {
@@ -241,6 +241,6 @@ output_escaped_str(char *str, bool quoted)
                        fputc(str[i], yyout);
        }
 
-       if (quoted && str[0] == '\"' && str[len] == '\"')
+       if (quoted && str[0] == '"' && str[len] == '"')
                fputs("\"", yyout);
 }