bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Bruno Haible <bruno@clisp.org>
Cc: bug-gnulib@gnu.org
Subject: Re: [PATCH] Simplify and regularize regex use of ‘assert’
Date: Sun, 13 Oct 2019 13:18:42 -0700	[thread overview]
Message-ID: <b5b7f82e-e79c-904f-b15e-82fc572c12bf@cs.ucla.edu> (raw)
In-Reply-To: <1769652.U0JQk7zMHs@omega>

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

On 10/13/19 5:20 AM, Bruno Haible wrote:
> Karl's autoupdate from glibc reverted this change.

Thanks for mentioning that. I installed the attached to fix it. I do plan to 
migrate this back to glibc, but one step at a time.

[-- Attachment #2: 0001-config-srclist.txt-Remove-posix-regex_internal.c-for.patch --]
[-- Type: text/x-patch, Size: 2541 bytes --]

From 6cfb4302b3e1da14d706198b693558290e9b00f4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 13 Oct 2019 13:17:05 -0700
Subject: [PATCH] * config/srclist.txt: Remove posix/regex_internal.c for now.

---
 ChangeLog            |  4 ++++
 config/srclist.txt   |  2 +-
 lib/regex_internal.c | 13 ++++---------
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 877e275e7..d27674fa6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2019-10-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* config/srclist.txt: Remove posix/regex_internal.c for now.
+
 2019-10-13  Bruno Haible  <bruno@clisp.org>
 
 	git-version-gen: Allow 'snapshot' as .tarball-version contents.
diff --git a/config/srclist.txt b/config/srclist.txt
index c53fb90a8..e001d15c3 100644
--- a/config/srclist.txt
+++ b/config/srclist.txt
@@ -55,7 +55,7 @@ $LIBCSRC malloc/scratch_buffer_set_array_size.c	lib/malloc
 #$LIBCSRC posix/regcomp.c		lib
 $LIBCSRC posix/regex.c			lib
 $LIBCSRC posix/regex.h			lib
-$LIBCSRC posix/regex_internal.c		lib
+#$LIBCSRC posix/regex_internal.c	lib
 #$LIBCSRC posix/regex_internal.h	lib
 #$LIBCSRC posix/regexec.c		lib
 $LIBCSRC time/timegm.c			lib
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 99fbb26ec..6aa911608 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -212,7 +212,7 @@ build_wcs_buffer (re_string_t *pstr)
 {
 #ifdef _LIBC
   unsigned char buf[MB_LEN_MAX];
-  assert (MB_LEN_MAX >= pstr->mb_cur_max);
+  DEBUG_ASSERT (MB_LEN_MAX >= pstr->mb_cur_max);
 #else
   unsigned char buf[64];
 #endif
@@ -285,7 +285,7 @@ build_wcs_upper_buffer (re_string_t *pstr)
   size_t mbclen;
 #ifdef _LIBC
   char buf[MB_LEN_MAX];
-  assert (MB_LEN_MAX >= pstr->mb_cur_max);
+  DEBUG_ASSERT (pstr->mb_cur_max <= MB_LEN_MAX);
 #else
   char buf[64];
 #endif
@@ -685,9 +685,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
 			 pstr->valid_len - offset);
 	      pstr->valid_len -= offset;
 	      pstr->valid_raw_len -= offset;
-#if defined DEBUG && DEBUG
-	      assert (pstr->valid_len > 0);
-#endif
+	      DEBUG_ASSERT (pstr->valid_len > 0);
 	    }
 	}
       else
@@ -941,10 +939,7 @@ re_string_context_at (const re_string_t *input, Idx idx, int eflags)
       Idx wc_idx = idx;
       while(input->wcs[wc_idx] == WEOF)
 	{
-#if defined DEBUG && DEBUG
-	  /* It must not happen.  */
-	  assert (wc_idx >= 0);
-#endif
+	  DEBUG_ASSERT (wc_idx >= 0);
 	  --wc_idx;
 	  if (wc_idx < 0)
 	    return input->tip_context;
-- 
2.17.1


      reply	other threads:[~2019-10-13 20:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 19:44 [PATCH] Simplify and regularize regex use of ‘assert’ Paul Eggert
2019-10-13 12:20 ` Bruno Haible
2019-10-13 20:18   ` 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=b5b7f82e-e79c-904f-b15e-82fc572c12bf@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bruno@clisp.org \
    --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).