gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] gawk branch, feature/minrx, updated. gawk-4.1.0-5394-g8d963627


From: Arnold Robbins
Subject: [SCM] gawk branch, feature/minrx, updated. gawk-4.1.0-5394-g8d963627
Date: Thu, 19 Oct 2023 00:52:22 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, feature/minrx has been updated
       via  8d9636270e3fb84f956fd9ff88dce9f1c411c88b (commit)
      from  986e9d3149f879367ca56b2a34dba310483e312a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=8d9636270e3fb84f956fd9ff88dce9f1c411c88b

commit 8d9636270e3fb84f956fd9ff88dce9f1c411c88b
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Oct 19 07:52:01 2023 +0300

    Adjust re.c to updated minrx API.

diff --git a/re.c b/re.c
index 7341efb5..6cc61116 100644
--- a/re.c
+++ b/re.c
@@ -29,6 +29,7 @@
 
 static void check_bracket_exp(char *s, size_t len);
 const char *regexflags2str(int flags);
+static const char *get_minrx_regerror(int errcode, Regexp *rp);
 
 static struct localeinfo localeinfo;
 
@@ -315,7 +316,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, 
bool dfa, bool canfatal)
        if ((ret = minrx_regncomp(& rp->mre_pat, len, buf, flags)) != 0) {
                refree(rp);
                /* rerr already gettextized inside regex routines */
-               rerr = minrx_regerror(ret);
+               rerr = get_minrx_regerror(ret, rp);
                if (! canfatal) {
                        error("%s: /%s/", rerr, s);
                        return NULL;
@@ -415,13 +416,20 @@ research(Regexp *rp, char *str, int start,
 
        rp->pat.not_bol = 0;
 #else
+       memset(rp->mre_regs, 0, rp->mre_pat.re_nsub * sizeof(minrx_regmatch_t));
+
+       if (start > 0) {
+               rp->mre_regs[0].rm_eo = start;
+               minrx_flags |= MINRX_REG_RESUME;
+       }
+
        res = minrx_regnexec(&(rp->mre_pat),
-                       len, str + start,
+                       len, str,
                        need_start ? rp->mre_pat.re_nsub : 1,
                        need_start ? rp->mre_regs : NULL,
                        minrx_flags);
        if (res == 0)
-               res = rp->mre_regs[0].rm_so + start;
+               res = rp->mre_regs[0].rm_so;
        else
                res = -1;
 #endif
@@ -439,6 +447,28 @@ refree(Regexp *rp)
        efree(rp);
 }
 
+/* get_minrx_regerror --- return the error as a string, hide ugly POSIX 
interface */
+
+static const char *
+get_minrx_regerror(int errcode, Regexp *rp)
+{
+       static char *buf, *p;
+       static size_t bufsize;
+       static int count;
+
+       if (buf == NULL) {      // first time through, allocate the buffer
+               bufsize = 100;
+               emalloc(buf, char *, bufsize, "get_minrx_regerror");
+       }
+
+       while ((count = minrx_regerror(errcode, & rp->mre_pat, buf, bufsize)) > 
bufsize) {
+               bufsize *= 2;
+               erealloc(buf, char *, bufsize, "get_minrx_regerror");
+       }
+
+       return buf;
+}
+
 /* dfaerror --- print an error message for the dfa routines */
 
 void

-----------------------------------------------------------------------

Summary of changes:
 re.c | 36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]