Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite621037

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 isprobably easier to read/understand anyway, and one can hardly argue thatit's worth shaving cycles off the case of reporting another error whenone has already been detected. The INSIST change limits where that macrocan be used, but not in a way that creates a problem for any existing call.
1 parentfbcf2cf commite621037

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
#defineEAT(t)(SEE(t) && next(v))/* if next is this, swallow it */
233233
#defineVISERR(vv)((vv)->err != 0)/* have we seen an error yet? */
234234
#defineISERR() VISERR(v)
235-
#defineVERR(vv,e)((vv)->nexttype = EOS,((vv)->err) ? (vv)->err :\
236-
((vv)->err = (e)))
235+
#defineVERR(vv,e)((vv)->nexttype = EOS, \
236+
(vv)->err = ((vv)->err ? (vv)->err : (e)))
237237
#defineERR(e)VERR(v, e)/* record an error */
238238
#defineNOERR() {if (ISERR()) return;}/* if error seen, return */
239239
#defineNOERRN(){if (ISERR()) return NULL;}/* NOERR with retval */
240240
#defineNOERRZ(){if (ISERR()) return 0;}/* NOERR with retval */
241-
#defineINSIST(c,e)((c) ? 0 : ERR(e))/* ifcondition false, error */
241+
#defineINSIST(c,e) do { if (!(c)) ERR(e); } while (0)/*errorifc false */
242242
#defineNOTE(b) (v->re->re_info |= (b))/* note visible condition */
243243
#defineEMPTYARC(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
#defineVISERR(vv)((vv)->err != 0)/* have we seen an error yet? */
121121
#defineISERR() VISERR(v)
122-
#defineVERR(vv,e)(((vv)->err) ? (vv)->err: ((vv)->err= (e)))
122+
#defineVERR(vv,e)((vv)->err = ((vv)->err? (vv)->err: (e)))
123123
#defineERR(e)VERR(v, e)/* record an error */
124124
#defineNOERR() {if (ISERR()) return v->err;}/* if error seen, return it */
125125
#defineOFF(p)((p) - v->start)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp