[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, feature/mdim-restart, updated. gawk-4.1.0-4784-g2627f
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, feature/mdim-restart, updated. gawk-4.1.0-4784-g2627f6bc |
Date: |
Fri, 3 Jun 2022 04:30:48 -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/mdim-restart has been updated
via 2627f6bc294a64e0486f6e7a62c4980786e65756 (commit)
via a7211881a2bf1600e6ffb990e77d95e94e64b088 (commit)
from c8da61eb496e9f814ba03681993455ec1d7a0e16 (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=2627f6bc294a64e0486f6e7a62c4980786e65756
commit 2627f6bc294a64e0486f6e7a62c4980786e65756
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Jun 3 11:30:31 2022 +0300
Some more small fixes.
diff --git a/ChangeLog b/ChangeLog
index b1f298f6..bfd9ef72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
(cmp_scalars): Change usage of elem_new_to_scalar().
* interpret.h (r_interpret): Op_push*: Make Node_elem_new into
a separate case, using elem_new_to_scalar().
+ * array.c (force_array): For Node_elem_new, clear symbol->stptr.
+ * eval.r (r_get_lhs): Use efree() intstead of free() in Node_elem_new
+ case.
2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
diff --git a/array.c b/array.c
index ed8e3f3e..4361b51c 100644
--- a/array.c
+++ b/array.c
@@ -336,6 +336,7 @@ force_array(NODE *symbol, bool canfatal)
switch (symbol->type) {
case Node_elem_new:
efree(symbol->stptr);
+ symbol->stptr = NULL;
symbol->stlen = 0;
/* fall through */
case Node_var_new:
diff --git a/eval.c b/eval.c
index ff7543c1..e292cab6 100644
--- a/eval.c
+++ b/eval.c
@@ -1169,7 +1169,7 @@ r_get_lhs(NODE *n, bool reference)
break;
case Node_elem_new:
- free(n->stptr);
+ efree(n->stptr);
n->stptr = NULL;
n->stlen = 0;
n->type = Node_var;
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=a7211881a2bf1600e6ffb990e77d95e94e64b088
commit a7211881a2bf1600e6ffb990e77d95e94e64b088
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Jun 3 11:16:36 2022 +0300
Additional fixes for reference count > 1.
diff --git a/ChangeLog b/ChangeLog
index 72582c79..b1f298f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-06-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (elem_new_to_scalar): Add declaration.
+ * eval.c (elem_new_to_scalar): No longer static. Make it handle
+ things when valref is > 1. Returns a NODE * instead of being void.
+ (cmp_scalars): Change usage of elem_new_to_scalar().
+ * interpret.h (r_interpret): Op_push*: Make Node_elem_new into
+ a separate case, using elem_new_to_scalar().
+
2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
* builtin.c (do_sub): Fix memory corruption when substituting
diff --git a/awk.h b/awk.h
index 95cc9b67..4729c05f 100644
--- a/awk.h
+++ b/awk.h
@@ -1560,6 +1560,7 @@ extern STACK_ITEM *grow_stack(void);
extern void dump_fcall_stack(FILE *fp);
extern int register_exec_hook(Func_pre_exec preh, Func_post_exec posth);
extern NODE **r_get_field(NODE *n, Func_ptr *assign, bool reference);
+extern NODE *elem_new_to_scalar(NODE *n);
/* ext.c */
extern NODE *do_ext(int nargs);
void load_ext(const char *lib_name); /* temporary */
diff --git a/eval.c b/eval.c
index 528a097e..ff7543c1 100644
--- a/eval.c
+++ b/eval.c
@@ -1533,8 +1533,6 @@ eval_condition(NODE *t)
static bool cmp_doubles(const NODE *t1, const NODE *t2, scalar_cmp_t
comparison_type);
extern bool mpg_cmp_as_numbers(const NODE *t1, const NODE *t2, scalar_cmp_t
comparison_type);
-static void elem_new_to_scalar(NODE *n);
-
/* cmp_scalars -- compare two nodes on the stack */
static bool
@@ -1547,8 +1545,8 @@ cmp_scalars(scalar_cmp_t comparison_type)
t2 = POP_SCALAR();
t1 = TOP();
- elem_new_to_scalar(t1);
- elem_new_to_scalar(t2);
+ t1 = elem_new_to_scalar(t1);
+ t2 = elem_new_to_scalar(t2);
if (t1->type == Node_var_array) {
DEREF(t2);
@@ -1890,11 +1888,18 @@ init_interpret()
/* elem_new_to_scalar --- convert Node_elem_new to untyped scalar */
-static void
+NODE *
elem_new_to_scalar(NODE *n)
{
if (n->type != Node_elem_new)
- return;
+ return n;
+
+ if (n->valref > 1) {
+ unref(n);
+ return dupnode(Nnull_string);
+ }
n->type = Node_val;
+
+ return n;
}
diff --git a/interpret.h b/interpret.h
index e4cbd1f3..29fc7fce 100644
--- a/interpret.h
+++ b/interpret.h
@@ -211,7 +211,6 @@ top:
break;
case Node_var_new:
- case Node_elem_new:
uninitialized_scalar:
if (op != Op_push_arg_untyped) {
/* convert untyped to scalar */
@@ -225,6 +224,20 @@ uninitialized_scalar:
save_symbol->vname);
if (op != Op_push_arg_untyped)
m = dupnode(Nnull_string);
+ UPREF(m);
+ PUSH(m);
+ break;
+
+ case Node_elem_new:
+ if (op != Op_push_arg_untyped) {
+ /* convert untyped to scalar */
+ m = elem_new_to_scalar(m);
+ }
+ if (do_lint)
+ lintwarn(isparam ?
+ _("reference to uninitialized
argument `%s'") :
+ _("reference to uninitialized
variable `%s'"),
+
save_symbol->vname);
PUSH(m);
break;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 12 ++++++++++++
array.c | 1 +
awk.h | 1 +
eval.c | 19 ++++++++++++-------
interpret.h | 15 ++++++++++++++-
5 files changed, 40 insertions(+), 8 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, feature/mdim-restart, updated. gawk-4.1.0-4784-g2627f6bc,
Arnold Robbins <=