diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-06-28 22:21:23 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-06-28 22:21:23 +0300 |
commit | 741bf93462919d841ffd7f3ed8c85a202b9dc3f8 (patch) | |
tree | a400d3e2f0b45784a24d703b06d76c882a25bac1 | |
parent | 687e6594ca3a6195ef834a5466b5fc7de2de2d7b (diff) | |
download | egawk-741bf93462919d841ffd7f3ed8c85a202b9dc3f8.tar.gz egawk-741bf93462919d841ffd7f3ed8c85a202b9dc3f8.tar.bz2 egawk-741bf93462919d841ffd7f3ed8c85a202b9dc3f8.zip |
Additional memory fixes and test for typedregex.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | awk.h | 2 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/Makefile.in | 9 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/typedregex2.awk | 11 | ||||
-rw-r--r-- | test/typedregex2.ok | 4 |
8 files changed, 38 insertions, 3 deletions
@@ -5,6 +5,7 @@ * awkgram.y (make_regnode): Set valref to 1. * interpret.h (r_interpret): Have Op_push_re upref typed regexp. * builtin.c (do_typeof): OK to deref typed regex. + * awk.h (force_string): Do dupnode on the regexp text. 2015-06-26 Arnold D. Robbins <arnold@skeeve.com> @@ -1764,7 +1764,7 @@ static inline NODE * force_string(NODE *s) { if (s->type == Node_typedregex) - return s->re_exp; + return dupnode(s->re_exp); if ((s->flags & STRCUR) != 0 && (s->stfmt == -1 || s->stfmt == CONVFMTidx) diff --git a/test/ChangeLog b/test/ChangeLog index b121fbec..68718374 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2015-06-28 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (typedregex2): New test. + * typedregex2.awk, typedregex2.ok: New files. + 2015-06-26 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (dbugtypedre1): Renamed from dbugtypedre. diff --git a/test/Makefile.am b/test/Makefile.am index cfcc9d9e..df1f1e2c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -989,6 +989,8 @@ EXTRA_DIST = \ tweakfld.ok \ typedregex1.awk \ typedregex1.ok \ + typedregex2.awk \ + typedregex2.ok \ typeof1.awk \ typeof1.ok \ typeof2.awk \ @@ -1112,7 +1114,7 @@ GAWK_EXT_TESTS = \ splitarg4 strftime \ strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \ symtab7 symtab8 symtab9 \ - typedregex1 typeof1 typeof2 typeof3 typeof4 + typedregex1 typedregex2 typeof1 typeof2 typeof3 typeof4 timeout EXTRA_TESTS = inftest regtest diff --git a/test/Makefile.in b/test/Makefile.in index f850f59c..ec270c1b 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1246,6 +1246,8 @@ EXTRA_DIST = \ tweakfld.ok \ typedregex1.awk \ typedregex1.ok \ + typedregex2.awk \ + typedregex2.ok \ typeof1.awk \ typeof1.ok \ typeof2.awk \ @@ -1368,7 +1370,7 @@ GAWK_EXT_TESTS = \ splitarg4 strftime \ strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \ symtab7 symtab8 symtab9 \ - typedregex1 typeof1 typeof2 typeof3 typeof4 + typedregex1 typedregex2 typeof1 typeof2 typeof3 typeof4 EXTRA_TESTS = inftest regtest INET_TESTS = inetdayu inetdayt inetechu inetecht @@ -3923,6 +3925,11 @@ typedregex1: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +typedregex2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + typeof1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index e4cea0de..462128ea 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1337,6 +1337,11 @@ typedregex1: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +typedregex2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + typeof1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/typedregex2.awk b/test/typedregex2.awk new file mode 100644 index 00000000..e17df4be --- /dev/null +++ b/test/typedregex2.awk @@ -0,0 +1,11 @@ +BEGIN { + x = @/xxx/ + y = @/yyy/ + print typeof(x), typeof(y) + print x, y + + x++ + y = y "" + print typeof(x), typeof(y) + print x, y +} diff --git a/test/typedregex2.ok b/test/typedregex2.ok new file mode 100644 index 00000000..832ef551 --- /dev/null +++ b/test/typedregex2.ok @@ -0,0 +1,4 @@ +regexp regexp +xxx yyy +number string +1 yyy |