gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, feature/stringfix, updated. gawk-4.1.0-2


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, feature/stringfix, updated. gawk-4.1.0-2435-g384261e
Date: Sat, 28 Jan 2017 14:29:32 +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/stringfix has been updated
       via  384261e9ea2b5ad4481b907726c4c92e8711c880 (commit)
      from  abe02aa78b8d1620d7d142ab96b650b3acd9d54c (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=384261e9ea2b5ad4481b907726c4c92e8711c880

commit 384261e9ea2b5ad4481b907726c4c92e8711c880
Author: Andrew J. Schorr <address@hidden>
Date:   Sat Jan 28 09:29:10 2017 -0500

    Minor speedup to inetfile to use memcmp instead of strncmp.

diff --git a/ChangeLog b/ChangeLog
index 543021b..54516df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-28         Andrew J. Schorr     <address@hidden>
+
+       * io.c (inetfile): Replace strncmp with memcmp in a few places, now
+       that we are checking string length beforehand.
+
 2017-01-27         Andrew J. Schorr     <address@hidden>
 
        * io.c (redirect_string): Check explen positive before accessing *str.
diff --git a/io.c b/io.c
index 9d1d06a..8a6c718 100644
--- a/io.c
+++ b/io.c
@@ -3973,7 +3973,7 @@ inetfile(const char *str, size_t len, struct 
inet_socket_info *isi)
        struct inet_socket_info buf;
 
        /* syntax: /inet/protocol/localport/hostname/remoteport */
-       if (len < 5 || strncmp(cp, "/inet", 5) != 0)
+       if (len < 5 || memcmp(cp, "/inet", 5) != 0)
                /* quick exit */
                return false;
        if (! isi)
@@ -4003,9 +4003,9 @@ inetfile(const char *str, size_t len, struct 
inet_socket_info *isi)
        /* which protocol? */
        if (cpend - cp < 5)
                return false;
-       if (strncmp(cp, "tcp/", 4) == 0)
+       if (memcmp(cp, "tcp/", 4) == 0)
                isi->protocol = SOCK_STREAM;
-       else if (strncmp(cp, "udp/", 4) == 0)
+       else if (memcmp(cp, "udp/", 4) == 0)
                isi->protocol = SOCK_DGRAM;
        else
                return false;

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

Summary of changes:
 ChangeLog |    5 +++++
 io.c      |    6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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