[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5602-g6c170938
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5602-g6c170938 |
Date: |
Sun, 26 Jan 2025 07:53:11 -0500 (EST) |
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, gawk-5.3-stable has been updated
via 6c1709389b992853f0b2acc5eb9a856211d78344 (commit)
from 20346d5c5fc2b6f8d806430dd025090811a8eda4 (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=6c1709389b992853f0b2acc5eb9a856211d78344
commit 6c1709389b992853f0b2acc5eb9a856211d78344
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun Jan 26 14:52:43 2025 +0200
Clean up code for freeing a REGEX.
diff --git a/ChangeLog b/ChangeLog
index 0a7225af..07d55583 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-01-26 Arnold D. Robbins <arnold@skeeve.com>
+
+ * interpret.h (r_interpret): Case Op_store_var; move REGEX
+ check to ...
+ * node.c (r_unref): ... here.
+ * builtin.c (do_sub): Remove REGEX freeing code, simplify what
+ remained when checking if original target was a regex.
+
2025-01-24 Arnold D. Robbins <arnold@skeeve.com>
* interpret.h (r_interpret): Case Op_store_var; add a
diff --git a/builtin.c b/builtin.c
index f39c274c..ee75157b 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2178,20 +2178,8 @@ done:
* remain a regexp. In that case, we have to update the compiled
* regular expression that it holds.
*/
- bool is_regex = false;
- NODE *target = *lhs;
-
- if ((target->flags & REGEX) != 0) {
- is_regex = true;
-
- if (target->valref == 1) {
- // free old regex registers
- refree(target->typed_re->re_reg[0]);
- if (target->typed_re->re_reg[1] != NULL)
- refree(target->typed_re->re_reg[1]);
- freenode(target->typed_re);
- }
- }
+ bool is_regex = ((target->flags & REGEX) != 0);
+
unref(*lhs); // nuke original value
if (is_regex)
*lhs = make_typed_regex(buf, textlen);
diff --git a/interpret.h b/interpret.h
index 28d31bbb..239f2ed6 100644
--- a/interpret.h
+++ b/interpret.h
@@ -785,14 +785,6 @@ mod:
lhs = get_lhs(pc->memory, false);
- if ((*lhs)->valref == 1 && ((*lhs)->flags & REGEX) !=
0) {
- refree((*lhs)->typed_re->re_reg[0]);
- if ((*lhs)->typed_re->re_reg[1] != NULL)
- refree((*lhs)->typed_re->re_reg[1]);
- unref((*lhs)->typed_re->re_exp);
- freenode((*lhs)->typed_re);
- }
-
unref(*lhs);
r = pc->initval; /* constant initializer */
if (r != NULL) {
diff --git a/node.c b/node.c
index 3e3bd109..117c01bf 100644
--- a/node.c
+++ b/node.c
@@ -538,6 +538,14 @@ r_unref(NODE *tmp)
if ((tmp->flags & (MALLOC|STRCUR)) == (MALLOC|STRCUR))
efree(tmp->stptr);
+ if ((tmp->flags & REGEX) != 0) {
+ refree(tmp->typed_re->re_reg[0]);
+ if (tmp->typed_re->re_reg[1] != NULL)
+ refree(tmp->typed_re->re_reg[1]);
+ unref(tmp->typed_re->re_exp);
+ freenode(tmp->typed_re);
+ }
+
mpfr_unset(tmp);
free_wstr(tmp);
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 8 ++++++++
builtin.c | 16 ++--------------
interpret.h | 8 --------
node.c | 8 ++++++++
4 files changed, 18 insertions(+), 22 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5602-g6c170938,
Arnold Robbins <=