Re: Fix for compiler warning in reloptions.c - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Fix for compiler warning in reloptions.c
Date
Msg-id 200901060316.n063Got25929@momjian.us
Whole thread Raw
In response to Re: Fix for compiler warning in reloptions.c  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
Alvaro Herrera wrote:
> Bruce Momjian wrote:
> > The attached applied patch prevents a compiler warning;  the compiler
> > doesn't know about our elog(ERROR) exit case.
>
> Hmm, I don't like your fix; ISTM it would be better to set the variable
> only in the default: case (or maybe change the "break" for a "return").

Agreed, I used the 'default' idea, attached, applied.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/backend/access/common/reloptions.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/common/reloptions.c,v
retrieving revision 1.14
diff -c -c -r1.14 reloptions.c
*** src/backend/access/common/reloptions.c    6 Jan 2009 02:44:17 -0000    1.14
--- src/backend/access/common/reloptions.c    6 Jan 2009 03:10:36 -0000
***************
*** 667,673 ****
  {
      char       *value;
      int            value_len;
!     bool        parsed = true;  /* quiet compiler */
      bool        nofree = false;

      if (option->isset && validate)
--- 667,673 ----
  {
      char       *value;
      int            value_len;
!     bool        parsed;
      bool        nofree = false;

      if (option->isset && validate)
***************
*** 736,741 ****
--- 736,742 ----
              break;
          default:
              elog(ERROR, "unsupported reloption type %d", option->gen->type);
+             parsed = true; /* quiet compiler */
              break;
      }


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: contrib Japanese README
Next
From: Joe Conway
Date:
Subject: Re: dblink vs SQL/MED - security and implementation details