From 26e737a2c890dd82f64e7886e892a2ca9776ea36 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Fri, 4 Jan 2008 11:54:55 +0000 Subject: [PATCH] change order --- src/core/ngx_inet.c | 91 +++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index 702d6453a..ca6c5f6e8 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -8,6 +8,9 @@ #include +static size_t ngx_sprint_uchar(u_char *text, u_char c, size_t len); + + /* AF_INET only */ in_addr_t @@ -63,50 +66,6 @@ ngx_inet_addr(u_char *text, size_t len) * than using FreeBSD libc's snprintf(). */ - -static ngx_inline size_t -ngx_sprint_uchar(u_char *text, u_char c, size_t len) -{ - size_t n; - ngx_uint_t c1, c2; - - n = 0; - - if (len == n) { - return n; - } - - c1 = c / 100; - - if (c1) { - *text++ = (u_char) (c1 + '0'); - n++; - - if (len == n) { - return n; - } - } - - c2 = (c % 100) / 10; - - if (c1 || c2) { - *text++ = (u_char) (c2 + '0'); - n++; - - if (len == n) { - return n; - } - } - - c2 = c % 10; - - *text++ = (u_char) (c2 + '0'); - n++; - - return n; -} - - /* AF_INET only */ size_t @@ -163,6 +122,7 @@ ngx_sock_ntop(int family, struct sockaddr *sa, u_char *text, size_t len) return n; } + size_t ngx_inet_ntop(int family, void *addr, u_char *text, size_t len) { @@ -216,6 +176,49 @@ ngx_inet_ntop(int family, void *addr, u_char *text, size_t len) } +static size_t +ngx_sprint_uchar(u_char *text, u_char c, size_t len) +{ + size_t n; + ngx_uint_t c1, c2; + + n = 0; + + if (len == n) { + return n; + } + + c1 = c / 100; + + if (c1) { + *text++ = (u_char) (c1 + '0'); + n++; + + if (len == n) { + return n; + } + } + + c2 = (c % 100) / 10; + + if (c1 || c2) { + *text++ = (u_char) (c2 + '0'); + n++; + + if (len == n) { + return n; + } + } + + c2 = c % 10; + + *text++ = (u_char) (c2 + '0'); + n++; + + return n; +} + + /* AF_INET only */ ngx_int_t