Content-Length: 334725 | pFad | http://github.com/postgrespro/postgres/commit/e621037eec4a1c9ec2d7056c9c1c11b9b03932cb

AE Tweak a couple of macros in the regex code to suppress compiler warnings · postgrespro/postgres@e621037 · GitHub
Skip to content

Commit e621037

Browse files
committed
Tweak a couple of macros in the regex code to suppress compiler warnings
from "clang". The VERR changes make an assignment unconditional, which is probably easier to read/understand anyway, and one can hardly argue that it's worth shaving cycles off the case of reporting another error when one has already been detected. The INSIST change limits where that macro can be used, but not in a way that creates a problem for any existing call.
1 parent fbcf2cf commit e621037

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/backend/regex/regcomp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2929
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030
*
31-
* $PostgreSQL: pgsql/src/backend/regex/regcomp.c,v 1.48 2010/02/26 02:00:57 momjian Exp $
31+
* $PostgreSQL: pgsql/src/backend/regex/regcomp.c,v 1.49 2010/08/02 02:29:39 tgl Exp $
3232
*
3333
*/
3434

@@ -232,13 +232,13 @@ struct vars
232232
#define EAT(t) (SEE(t) && next(v)) /* if next is this, swallow it */
233233
#define VISERR(vv) ((vv)->err != 0) /* have we seen an error yet? */
234234
#define ISERR() VISERR(v)
235-
#define VERR(vv,e) ((vv)->nexttype = EOS, ((vv)->err) ? (vv)->err :\
236-
((vv)->err = (e)))
235+
#define VERR(vv,e) ((vv)->nexttype = EOS, \
236+
(vv)->err = ((vv)->err ? (vv)->err : (e)))
237237
#define ERR(e) VERR(v, e) /* record an error */
238238
#define NOERR() {if (ISERR()) return;} /* if error seen, return */
239239
#define NOERRN() {if (ISERR()) return NULL;} /* NOERR with retval */
240240
#define NOERRZ() {if (ISERR()) return 0;} /* NOERR with retval */
241-
#define INSIST(c, e) ((c) ? 0 : ERR(e)) /* if condition false, error */
241+
#define INSIST(c, e) do { if (!(c)) ERR(e); } while (0) /* error if c false */
242242
#define NOTE(b) (v->re->re_info |= (b)) /* note visible condition */
243243
#define EMPTYARC(x, y) newarc(v->nfa, EMPTY, 0, x, y)
244244

src/backend/regex/regexec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2828
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
*
30-
* $PostgreSQL: pgsql/src/backend/regex/regexec.c,v 1.28 2010/02/01 02:45:29 tgl Exp $
30+
* $PostgreSQL: pgsql/src/backend/regex/regexec.c,v 1.29 2010/08/02 02:29:39 tgl Exp $
3131
*
3232
*/
3333

@@ -119,7 +119,7 @@ struct vars
119119

120120
#define VISERR(vv) ((vv)->err != 0) /* have we seen an error yet? */
121121
#define ISERR() VISERR(v)
122-
#define VERR(vv,e) (((vv)->err) ? (vv)->err : ((vv)->err = (e)))
122+
#define VERR(vv,e) ((vv)->err = ((vv)->err ? (vv)->err : (e)))
123123
#define ERR(e) VERR(v, e) /* record an error */
124124
#define NOERR() {if (ISERR()) return v->err;} /* if error seen, return it */
125125
#define OFF(p) ((p) - v->start)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/e621037eec4a1c9ec2d7056c9c1c11b9b03932cb

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy