psql: Remove inappropriate const qualifiers
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 16 Mar 2012 18:03:38 +0000 (20:03 +0200)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 16 Mar 2012 18:35:00 +0000 (20:35 +0200)
Since mbvalidate() can alter the string it validates, having the
callers claim that the strings they accept are const is inappropriate.

src/bin/psql/mbprint.c
src/bin/psql/print.c
src/bin/psql/print.h

index d43973e96a005d57580dab6067ee5e2b8b4a21fb..7d379ef3b853f8f9578d34ba03c1467131db8293 100644 (file)
@@ -385,7 +385,7 @@ unsigned char *
 mbvalidate(unsigned char *pwcs, int encoding)
 {
        if (encoding == PG_UTF8)
-               mb_utf_validate((unsigned char *) pwcs);
+               mb_utf_validate(pwcs);
        else
        {
                /*
index 72bac51ecb0ff43c1d2cb9909753e70bad5ba2b7..d2474716dbc03aff539d3342ba82825a8d93336b 100644 (file)
@@ -2122,7 +2122,7 @@ printTableInit(printTableContent *const content, const printTableOpt *opt,
  * column.
  */
 void
-printTableAddHeader(printTableContent *const content, const char *header,
+printTableAddHeader(printTableContent *const content, char *header,
                                        const bool translate, const char align)
 {
 #ifndef ENABLE_NLS
@@ -2162,7 +2162,7 @@ printTableAddHeader(printTableContent *const content, const char *header,
  * Note: Automatic freeing of translatable strings is not supported.
  */
 void
-printTableAddCell(printTableContent *const content, const char *cell,
+printTableAddCell(printTableContent *const content, char *cell,
                                  const bool translate, const bool mustfree)
 {
 #ifndef ENABLE_NLS
index 931535e478f2623e281cbcb0aae945cea24403f4..c7377562c505fc3cbfebfbf0d2fa5666baf6e6ec 100644 (file)
@@ -162,9 +162,9 @@ extern void printTableInit(printTableContent *const content,
                           const printTableOpt *opt, const char *title,
                           const int ncolumns, const int nrows);
 extern void printTableAddHeader(printTableContent *const content,
-                                const char *header, const bool translate, const char align);
+                                char *header, const bool translate, const char align);
 extern void printTableAddCell(printTableContent *const content,
-                               const char *cell, const bool translate, const bool mustfree);
+                               char *cell, const bool translate, const bool mustfree);
 extern void printTableAddFooter(printTableContent *const content,
                                        const char *footer);
 extern void printTableSetFooter(printTableContent *const content,