]> granicus.if.org Git - postgresql/blobdiff - src/backend/utils/adt/inet_net_ntop.c
Move some system includes into c.h, and remove duplicates.
[postgresql] / src / backend / utils / adt / inet_net_ntop.c
index 8c185dc83caa2a6c348afc8942c858de4baa1793..c38ecc5a6f2150181052657bc7ad965ce2f3a4e7 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.5 1999/05/25 05:29:38 momjian Exp $";
+static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.8 1999/07/17 20:17:56 momjian Exp $";
 
 #endif
 
@@ -26,12 +26,9 @@ static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.5 1999/05/25 05:29:38 momj
 #include <arpa/inet.h>
 
 #include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
 
-#include <postgres.h>
-#include <utils/builtins.h>
+#include "postgres.h"
+#include "utils/builtins.h"
 
 #ifdef SPRINTF_CHAR
 #define SPRINTF(x) strlen(sprintf/**/x)
@@ -40,9 +37,9 @@ static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.5 1999/05/25 05:29:38 momj
 #endif
 
 static char *inet_net_ntop_ipv4(const u_char *src, int bits,
-                                                               char *dst, size_t size);
+                                  char *dst, size_t size);
 static char *inet_cidr_ntop_ipv4(const u_char *src, int bits,
-                                                               char *dst, size_t size);
+                                       char *dst, size_t size);
 
 /*
  * char *
@@ -59,7 +56,7 @@ inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size)
 {
        switch (af)
        {
-               case AF_INET:
+                       case AF_INET:
                        return (inet_cidr_ntop_ipv4(src, bits, dst, size));
                default:
                        errno = EAFNOSUPPORT;
@@ -162,7 +159,7 @@ inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size)
 {
        switch (af)
        {
-               case AF_INET:
+                       case AF_INET:
                        return (inet_net_ntop_ipv4(src, bits, dst, size));
                default:
                        errno = EAFNOSUPPORT;
@@ -186,10 +183,11 @@ inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size)
 static char *
 inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
 {
-       char *odst = dst;
-       char *t;
-       size_t len = 4;
-       int b, tb;
+       char       *odst = dst;
+       char       *t;
+       size_t          len = 4;
+       int                     b,
+                               tb;
 
        if (bits < 0 || bits > 32)
        {
@@ -218,7 +216,7 @@ inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
                        *dst++ = '.';
                        *dst = '\0';
                }
-               size -= (size_t)(dst - t);
+               size -= (size_t) (dst - t);
        }
 
        /* don't print masklen if 32 bits */
@@ -232,7 +230,7 @@ inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
 
        return (odst);
 
- emsgsize:
+emsgsize:
        errno = EMSGSIZE;
        return (NULL);
 }