Add some const decorations
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 28 Jan 2022 08:13:11 +0000 (09:13 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 28 Jan 2022 08:13:11 +0000 (09:13 +0100)
src/backend/commands/copyto.c

index 34c8b805934dc4b62e2e0b8ea5bb7af9e0df2277..20bfd49112a5f44e1b1180c4109f1b060ef5bf06 100644 (file)
@@ -116,8 +116,8 @@ static const char BinarySignature[11] = "PGCOPY\n\377\r\n\0";
 static void EndCopy(CopyToState cstate);
 static void ClosePipeToProgram(CopyToState cstate);
 static void CopyOneRowTo(CopyToState cstate, TupleTableSlot *slot);
-static void CopyAttributeOutText(CopyToState cstate, char *string);
-static void CopyAttributeOutCSV(CopyToState cstate, char *string,
+static void CopyAttributeOutText(CopyToState cstate, const char *string);
+static void CopyAttributeOutCSV(CopyToState cstate, const char *string,
                                bool use_quote, bool single_attr);
 
 /* Low-level communications functions */
@@ -1009,10 +1009,10 @@ CopyOneRowTo(CopyToState cstate, TupleTableSlot *slot)
    } while (0)
 
 static void
-CopyAttributeOutText(CopyToState cstate, char *string)
+CopyAttributeOutText(CopyToState cstate, const char *string)
 {
-   char       *ptr;
-   char       *start;
+   const char *ptr;
+   const char *start;
    char        c;
    char        delimc = cstate->opts.delim[0];
 
@@ -1162,11 +1162,11 @@ CopyAttributeOutText(CopyToState cstate, char *string)
  * CSV-style escaping
  */
 static void
-CopyAttributeOutCSV(CopyToState cstate, char *string,
+CopyAttributeOutCSV(CopyToState cstate, const char *string,
                    bool use_quote, bool single_attr)
 {
-   char       *ptr;
-   char       *start;
+   const char *ptr;
+   const char *start;
    char        c;
    char        delimc = cstate->opts.delim[0];
    char        quotec = cstate->opts.quote[0];
@@ -1194,7 +1194,7 @@ CopyAttributeOutCSV(CopyToState cstate, char *string,
            use_quote = true;
        else
        {
-           char       *tptr = ptr;
+           const char *tptr = ptr;
 
            while ((c = *tptr) != '\0')
            {