gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2583-g3f0610


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2583-g3f06102
Date: Thu, 22 Jun 2017 15:22:58 -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, master has been updated
       via  3f061027b6f0e2fe75b59d17efe93c0b84535b1a (commit)
       via  f4df3ba54ba5c2a4aec34d643424834c03645dd9 (commit)
      from  a702a6b6d6009068f4608a865bdd06a07259cf67 (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=3f061027b6f0e2fe75b59d17efe93c0b84535b1a

commit 3f061027b6f0e2fe75b59d17efe93c0b84535b1a
Merge: f4df3ba a702a6b
Author: Andrew J. Schorr <address@hidden>
Date:   Thu Jun 22 15:22:46 2017 -0400

    Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/gawk


http://git.sv.gnu.org/cgit/gawk.git/commit/?id=f4df3ba54ba5c2a4aec34d643424834c03645dd9

commit f4df3ba54ba5c2a4aec34d643424834c03645dd9
Author: Andrew J. Schorr <address@hidden>
Date:   Thu Jun 22 15:21:38 2017 -0400

    In rwarray extensions, use malloc where calloc not needed.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 9574865..8bb9759 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,5 +1,11 @@
 2017-06-22         Andrew J. Schorr     <address@hidden>
 
+       * rwarray.c (read_value): Use malloc instead of calloc, since
+       we immediately overwrite the buffer with data from the file.
+       * rwarray0.c (read_value): Ditto.
+
+2017-06-22         Andrew J. Schorr     <address@hidden>
+
        * readfile.c (read_file_to_buffer): Use emalloc instead of ezalloc,
        since there's no need to initialize the memory to zero before 
        overwriting it with the file's contents.
diff --git a/extension/rwarray.c b/extension/rwarray.c
index 370e38a..53c908d 100644
--- a/extension/rwarray.c
+++ b/extension/rwarray.c
@@ -482,12 +482,13 @@ read_value(FILE *fp, awk_value_t *value)
                        break;
                }
                value->str_value.len = len;
-               value->str_value.str = gawk_calloc(1, len + 1);
+               value->str_value.str = gawk_malloc(len + 1);
 
                if (fread(value->str_value.str, 1, len, fp) != (ssize_t) len) {
                        gawk_free(value->str_value.str);
                        return awk_false;
                }
+               value->str_value.str[len] = '\0';
        }
 
        return awk_true;
diff --git a/extension/rwarray0.c b/extension/rwarray0.c
index abeb532..79dee79 100644
--- a/extension/rwarray0.c
+++ b/extension/rwarray0.c
@@ -446,12 +446,13 @@ read_value(int fd, awk_value_t *value)
                len = ntohl(len);
                value->val_type = AWK_STRING;
                value->str_value.len = len;
-               value->str_value.str = calloc(1, len + 1);
+               value->str_value.str = malloc(len + 1);
 
                if (read(fd, value->str_value.str, len) != (ssize_t) len) {
                        free(value->str_value.str);
                        return awk_false;
                }
+               value->str_value.str[len] = '\0';
        }
 
        return awk_true;

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

Summary of changes:
 extension/ChangeLog  | 6 ++++++
 extension/rwarray.c  | 3 ++-
 extension/rwarray0.c | 3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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