diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2017-01-28 09:29:10 -0500 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2017-01-28 09:29:10 -0500 |
commit | 384261e9ea2b5ad4481b907726c4c92e8711c880 (patch) | |
tree | d4638d7512b30496f9548e056960627860f5e37c /io.c | |
parent | abe02aa78b8d1620d7d142ab96b650b3acd9d54c (diff) | |
download | egawk-384261e9ea2b5ad4481b907726c4c92e8711c880.tar.gz egawk-384261e9ea2b5ad4481b907726c4c92e8711c880.tar.bz2 egawk-384261e9ea2b5ad4481b907726c4c92e8711c880.zip |
Minor speedup to inetfile to use memcmp instead of strncmp.
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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; |