brianp 02/05/04 23:33:37
Modified: network_io/unix inet_ntop.c
Log:
optimized away some loop iterations in inet_ntop6()
Revision Changes Path
1.17 +5 -6 apr/network_io/unix/inet_ntop.c
Index: inet_ntop.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/inet_ntop.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- inet_ntop.c 5 May 2002 06:19:42 -0000 1.16
+++ inet_ntop.c 5 May 2002 06:33:37 -0000 1.17
@@ -203,13 +203,11 @@
* 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 @@
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)) {