gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, feature/andy, updated. gawk-4.1.0-2363-g


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, feature/andy, updated. gawk-4.1.0-2363-g16761af
Date: Sun, 4 Dec 2016 21:51:11 +0000 (UTC)

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/andy has been updated
       via  16761af5b3cec40f1e341cb33787af33cb2b45c2 (commit)
      from  4a20341b487c17b49fc455ba37df84946eda38a7 (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=16761af5b3cec40f1e341cb33787af33cb2b45c2

commit 16761af5b3cec40f1e341cb33787af33cb2b45c2
Author: Andrew J. Schorr <address@hidden>
Date:   Sun Dec 4 16:50:50 2016 -0500

    Improve API regex support.

diff --git a/ChangeLog b/ChangeLog
index b987dc7..298ad7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2016-12-04         Andrew J. Schorr     <address@hidden>
 
+       * gawkapi.c (assign_regex): Do not call assign_string, since we
+       know that a REGEX value is not an unterminated field string.
+       * gawkapi.h (make_regex): Delete macro.
+       (make_const_regex, make_malloced_regex): Add new macros to replace
+       make_regex with necessary memory management support.
+
+2016-12-04         Andrew J. Schorr     <address@hidden>
+
        * awk.h (fixtype): Remove conditional checking if the node type
        is Node_val. This is already covered by the assert, and if it's not
        true, we have serious bugs.
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 2e08def..ddf454f 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,5 +1,10 @@
 2016-12-04         Andrew J. Schorr     <address@hidden>
 
+       * gawktexi.in: Remove make_regex and replace it with make_const_regex
+       and make_malloced_regex.
+
+2016-12-04         Andrew J. Schorr     <address@hidden>
+
        * gawktexi.in: Document new flatten_array_typed API function, and
        indicate that the old flatten_array function has been superseded.
 
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 17206bc..1450d09 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -31796,9 +31796,17 @@ This function simply creates a numeric value in the 
@code{awk_value_t} variable
 pointed to by @code{result}.
 
 @item static inline awk_value_t *
address@hidden make_regex(const char *string, size_t length, awk_value_t 
*result);
address@hidden make_const_regex(const char *string, size_t length, awk_value_t 
*result);
+This function creates a strongly typed regexp value by allocating a copy of 
the string.
address@hidden is the regular expression of length @code{len}.
+
address@hidden static inline awk_value_t *
address@hidden make_malloced_regex(const char *string, size_t length, 
awk_value_t *result);
 This function creates a strongly typed regexp value.
 @code{string} is the regular expression of length @code{len}.
+It expects @code{string} to be a @samp{char *}
+value pointing to data previously obtained from @code{gawk_malloc()}, 
@code{gawk_calloc()}, or @code{gawk_realloc()}.
+
 @end table
 
 @node Registration Functions
diff --git a/gawkapi.c b/gawkapi.c
index 4b4b584..8fe57fc 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -449,7 +449,11 @@ assign_string(NODE *node, awk_value_t *val)
 static inline void
 assign_regex(NODE *node, awk_value_t *val)
 {
-       assign_string(node, val);
+       /* a REGEX node cannot be an unterminated field string */
+       assert((node->flags & MALLOC) != 0);
+       assert(node->stptr[node->stlen] == '\0');
+       val->str_value.str = node->stptr;
+       val->str_value.len = node->stlen;
        val->val_type = AWK_REGEX;
 }
 
diff --git a/gawkapi.h b/gawkapi.h
index 0d9a68a..4ae3649 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -891,7 +891,9 @@ r_make_string(const gawk_api_t *api,        /* needed for 
emalloc */
 
 #define make_const_string(str, len, result)    r_make_string(api, ext_id, str, 
len, 1, result)
 #define make_malloced_string(str, len, result) r_make_string(api, ext_id, str, 
len, 0, result)
-#define make_regex(str, len, result)   r_make_string_type(api, ext_id, str, 
len, 1, result, AWK_REGEX)
+
+#define make_const_regex(str, len, result)     r_make_string_type(api, ext_id, 
str, len, 1, result, AWK_REGEX)
+#define make_malloced_regex(str, len, result)  r_make_string_type(api, ext_id, 
str, len, 0, result, AWK_REGEX)
 
 /* make_null_string --- make a null string value */
 

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

Summary of changes:
 ChangeLog       |    8 ++++++++
 doc/ChangeLog   |    5 +++++
 doc/gawktexi.in |   10 +++++++++-
 gawkapi.c       |    6 +++++-
 gawkapi.h       |    4 +++-
 5 files changed, 30 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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