diff options
author | brianp <brianp@13f79535-47bb-0310-9956-ffa450edef68> | 2002-05-05 06:33:37 +0000 |
---|---|---|
committer | brianp <brianp@13f79535-47bb-0310-9956-ffa450edef68> | 2002-05-05 06:33:37 +0000 |
commit | 99aa6e7307a92b7a7b6c1cb12ada1adedbb18f48 (patch) | |
tree | 032ce5528f04b7d57ace44e5bffc05404fc287b2 /network_io/unix/inet_ntop.c | |
parent | 88b5388502c689dc896e6e7121799c393b35aa7c (diff) | |
download | libapr-99aa6e7307a92b7a7b6c1cb12ada1adedbb18f48.tar.gz |
optimized away some loop iterations in inet_ntop6()
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63361 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io/unix/inet_ntop.c')
-rw-r--r-- | network_io/unix/inet_ntop.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/network_io/unix/inet_ntop.c b/network_io/unix/inet_ntop.c index c0011deee..15e2c4521 100644 --- a/network_io/unix/inet_ntop.c +++ b/network_io/unix/inet_ntop.c @@ -203,13 +203,11 @@ inet_ntop6(const unsigned char *src, char *dst, apr_size_t size) * Format the result. */ tp = tmp; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { + for (i = 0; i < (IN6ADDRSZ / INT16SZ);) { /* Are we inside the best run of 0x00's? */ - if (best.base != -1 && i >= best.base && - i < (best.base + best.len)) { - if (i == best.base) { - *tp++ = ':'; - } + if (i == best.base) { + *tp++ = ':'; + i += best.len; continue; } /* Are we following an initial run of 0x00s or any real hex? */ @@ -226,6 +224,7 @@ inet_ntop6(const unsigned char *src, char *dst, apr_size_t size) break; } tp += apr_snprintf(tp, sizeof tmp - (tp - tmp), "%x", words[i]); + i++; } /* Was it a trailing run of 0x00's? */ if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) { |