Re: Refactor "mutually exclusive options" error reporting code in parse_subscription_options - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Refactor "mutually exclusive options" error reporting code in parse_subscription_options
Date
Msg-id 202107011429.26cy72mlca4o@alvherre.pgsql
Whole thread Raw
In response to Re: Refactor "mutually exclusive options" error reporting code in parse_subscription_options  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: Refactor "mutually exclusive options" error reporting code in parse_subscription_options  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
I find the business with OPT_NONE a bit uselessly verbose.  It's like we
haven't completely made up our minds that zero means no options set.
Wouldn't it be simpler to remove that #define and leave the variable
uninitialized until we want to set the options we want, and then use
plain assignment instead of |= ?

I propose the attached cleanup.  Some comments seem a bit too obvious;
the use of a local variable for specified_opts instead of directly
assigning to the one in the struct seemed unnecessary; places that call
parse_subscription_options() with only one bit set don't need a separate
variable for the allowed options; added some whitespace.

-- 
Álvaro Herrera           39°49'30"S 73°17'W  —  https://www.EnterpriseDB.com/

Attachment

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: PG 14 release notes, first draft
Next
From: Tom Lane
Date:
Subject: Re: Preventing abort() and exit() calls in libpq