bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH 4/4] regex: omit debug assignment when not debugging
Date: Wed,  9 Oct 2019 18:34:27 -0700	[thread overview]
Message-ID: <20191010013427.16129-4-eggert@cs.ucla.edu> (raw)
In-Reply-To: <20191010013427.16129-1-eggert@cs.ucla.edu>

* lib/regexec.c (re_search_internal) [!DEBUG]:
Remove unnecessary assignment to pacify Coverity.
---
 ChangeLog     | 4 ++++
 lib/regexec.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 360973ba4..e9e337666 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2019-10-09  Paul Eggert  <eggert@cs.ucla.edu>
 
+	regex: omit debug assignment when not debugging
+	* lib/regexec.c (re_search_internal) [!DEBUG]:
+	Remove unnecessary assignment.
+
 	regex: tell compiler there’s at most 256 arcs out
 	Partly this is to help the reader (and maybe help GCC);
 	partly this is to pacify Coverity.
diff --git a/lib/regexec.c b/lib/regexec.c
index 0d32e0139..809f89e26 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -817,7 +817,9 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
 		    break;
 		  if (__glibc_unlikely (err != REG_NOMATCH))
 		    goto free_return;
+#ifdef DEBUG
 		  match_last = -1;
+#endif
 		}
 	      else
 		break; /* We found a match.  */
-- 
2.21.0



      parent reply	other threads:[~2019-10-10  1:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10  1:34 [PATCH 1/4] regex: avoid copying of uninitialized storage Paul Eggert
2019-10-10  1:34 ` [PATCH 2/4] regex: simplify by assuming C99 Paul Eggert
2019-10-12 10:41   ` Bruno Haible
2019-10-10  1:34 ` [PATCH 3/4] regex: tell compiler there’s at most 256 arcs out Paul Eggert
2019-10-10  1:34 ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191010013427.16129-4-eggert@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).