ares_inet_pton/ntop: cleanup
authorDaniel Stenberg <daniel@haxx.se>
Sun, 17 Feb 2013 16:13:39 +0000 (17:13 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 17 Feb 2013 16:44:02 +0000 (17:44 +0100)
Make sure that the symbols are always exported and present in c-ares.

Make the headers prefixed with 'ares'.

Removed the inet_ntop.h version as it no longer features any content.

17 files changed:
Makefile.inc
acountry.c
adig.c
ahost.c
ares.h
ares__get_hostent.c
ares_gethostbyaddr.c
ares_gethostbyname.c
ares_getnameinfo.c
ares_inet_net_pton.h [new file with mode: 0644]
ares_init.c
ares_options.c
ares_parse_aaaa_reply.c
inet_net_pton.c
inet_net_pton.h [deleted file]
inet_ntop.c
inet_ntop.h [deleted file]

index ced51b2a11b3a421139469349201886f73388933..6a6363c770d4ff3f71d0108719f2ab88f339393a 100644 (file)
@@ -204,12 +204,8 @@ PDFPAGES = ares_cancel.pdf         \
 
 SAMPLESOURCES = ares_getopt.c          \
   ares_nowarn.c                                \
-  ares_strcasecmp.c                    \
-  inet_net_pton.c                      \
-  inet_ntop.c
+  ares_strcasecmp.c
 
 SAMPLEHEADERS = ares_getopt.h          \
   ares_nowarn.h                                \
-  ares_strcasecmp.h                    \
-  inet_net_pton.h                      \
-  inet_ntop.h
+  ares_strcasecmp.h
index 7a855c048ce952abf134c05fbdcbd4853f71b9e6..210ef84aee24eb5f32b47a88d266b7ebe2a7634e 100644 (file)
@@ -48,8 +48,6 @@
 
 #include "ares.h"
 #include "ares_getopt.h"
-#include "inet_net_pton.h"
-#include "inet_ntop.h"
 #include "ares_nowarn.h"
 
 #ifndef HAVE_STRDUP
diff --git a/adig.c b/adig.c
index 478310174832fd6379e53517cfcf77589d8cb029..e112dc0444bc17e1099e46d07e8f32dbc98cde8b 100644 (file)
--- a/adig.c
+++ b/adig.c
@@ -40,8 +40,6 @@
 
 #include "ares.h"
 #include "ares_dns.h"
-#include "inet_ntop.h"
-#include "inet_net_pton.h"
 #include "ares_getopt.h"
 #include "ares_nowarn.h"
 
diff --git a/ahost.c b/ahost.c
index cb2bea1bd02dda18b667ea67429e250a0d744160..fd6e50d51c5c6cb18154b3f94fbbc91258a34d83 100644 (file)
--- a/ahost.c
+++ b/ahost.c
@@ -28,8 +28,6 @@
 
 #include "ares.h"
 #include "ares_dns.h"
-#include "inet_ntop.h"
-#include "inet_net_pton.h"
 #include "ares_getopt.h"
 #include "ares_ipv6.h"
 #include "ares_nowarn.h"
diff --git a/ares.h b/ares.h
index f0cc82494eb8153c116a338a72d5f7b3d9b777d4..aaf0635f4516d55ce6998261039c973d9e889b7c 100644 (file)
--- a/ares.h
+++ b/ares.h
@@ -1,6 +1,6 @@
 
 /* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
- * Copyright (C) 2007-2011 by Daniel Stenberg
+ * Copyright (C) 2007-2013 by Daniel Stenberg
  *
  * Permission to use, copy, modify, and distribute this
  * software and its documentation for any purpose and without
@@ -579,6 +579,12 @@ CARES_EXTERN int ares_set_servers_csv(ares_channel channel,
 CARES_EXTERN int ares_get_servers(ares_channel channel,
                                   struct ares_addr_node **servers);
 
+CARES_EXTERN const char *ares_inet_ntop(int af, const void *src, char *dst,
+                                        socklen_t size);
+
+CARES_EXTERN int ares_inet_pton(int af, const char *src, void *dst);
+
+
 #ifdef  __cplusplus
 }
 #endif
index a9a80ef5e5afc71393ec3db03b79e552bcb79e39..4497d60d0d9f0af3bf25a103197e1bce0958691d 100644 (file)
@@ -27,7 +27,7 @@
 #endif
 
 #include "ares.h"
-#include "inet_net_pton.h"
+#include "ares_inet_net_pton.h"
 #include "ares_nowarn.h"
 #include "ares_private.h"
 
index 669a29d3d6e15c0c5b6373fb24bf1fc286250997..85862e2f854205f732979377e502934c46452888 100644 (file)
@@ -34,7 +34,7 @@
 #endif
 
 #include "ares.h"
-#include "inet_net_pton.h"
+#include "ares_inet_net_pton.h"
 #include "ares_platform.h"
 #include "ares_private.h"
 
index 14cf7efbd682490497c95bd64d11cea7440cf3e9..2b27b2e1048fccc0d4b0b9b8863bae64f86a1b6e 100644 (file)
@@ -1,5 +1,5 @@
 
-/* Copyright 1998, 2011 by the Massachusetts Institute of Technology.
+/* Copyright 1998, 2011, 2013 by the Massachusetts Institute of Technology.
  *
  * Permission to use, copy, modify, and distribute this
  * software and its documentation for any purpose and without
@@ -39,7 +39,7 @@
 #endif
 
 #include "ares.h"
-#include "inet_net_pton.h"
+#include "ares_inet_net_pton.h"
 #include "bitncmp.h"
 #include "ares_platform.h"
 #include "ares_nowarn.h"
index 75cb7edf526b1e15b477e6ad598ca37d43d1aff7..5b9f6386b29e01df18ba9a95c5c5540b32dd2840 100644 (file)
@@ -46,7 +46,6 @@
 
 #include "ares.h"
 #include "ares_ipv6.h"
-#include "inet_ntop.h"
 #include "ares_nowarn.h"
 #include "ares_private.h"
 
diff --git a/ares_inet_net_pton.h b/ares_inet_net_pton.h
new file mode 100644 (file)
index 0000000..90da2cc
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef HEADER_CARES_INET_NET_PTON_H
+#define HEADER_CARES_INET_NET_PTON_H
+
+/* Copyright (C) 2005-2013 by Daniel Stenberg et al
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ */
+
+#ifdef HAVE_INET_NET_PTON
+#define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z)
+#else
+int ares_inet_net_pton(int af, const char *src, void *dst, size_t size);
+#endif
+
+#endif /* HEADER_CARES_INET_NET_PTON_H */
index ddcc4f9462b9fbd599dd5bcd8a2c2d24d37614ea..d23c1b0ca33885f91c671beda3f57868e34a4a31 100644 (file)
@@ -1,6 +1,6 @@
 
 /* Copyright 1998 by the Massachusetts Institute of Technology.
- * Copyright (C) 2007-2012 by Daniel Stenberg
+ * Copyright (C) 2007-2013 by Daniel Stenberg
  *
  * Permission to use, copy, modify, and distribute this
  * software and its documentation for any purpose and without
@@ -50,8 +50,7 @@
 #endif
 
 #include "ares.h"
-#include "inet_ntop.h"
-#include "inet_net_pton.h"
+#include "ares_inet_net_pton.h"
 #include "ares_library_init.h"
 #include "ares_nowarn.h"
 #include "ares_platform.h"
index 5174ef26e4cfe7d18aba07debf9dbfa2c82cd34e..5466cb26457f223fb9899391b8923ed5953e646e 100644 (file)
@@ -1,6 +1,6 @@
 
 /* Copyright 1998 by the Massachusetts Institute of Technology.
- * Copyright (C) 2008-2011 by Daniel Stenberg
+ * Copyright (C) 2008-2013 by Daniel Stenberg
  *
  * Permission to use, copy, modify, and distribute this
  * software and its documentation for any purpose and without
@@ -24,7 +24,7 @@
 
 #include "ares.h"
 #include "ares_data.h"
-#include "inet_net_pton.h"
+#include "ares_inet_net_pton.h"
 #include "ares_private.h"
 
 
index f5b6eaef1025f09d77629a84d96c8b2b120f0326..77312499ada4dde4d777ecdb294b72dc7b24301a 100644 (file)
@@ -45,7 +45,7 @@
 
 #include "ares.h"
 #include "ares_dns.h"
-#include "inet_net_pton.h"
+#include "ares_inet_net_pton.h"
 #include "ares_private.h"
 
 int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
index 81999342d8524e13b6013bf5758966d7dcc191a6..71c07c59ca38359641588dfecb7fad4cf6891b2b 100644 (file)
@@ -36,7 +36,7 @@
 #include "ares.h"
 #include "ares_ipv6.h"
 #include "ares_nowarn.h"
-#include "inet_net_pton.h"
+#include "ares_inet_net_pton.h"
 
 
 const struct ares_in6_addr ares_in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
@@ -440,4 +440,11 @@ int ares_inet_pton(int af, const char *src, void *dst)
     return 0;
   return (result > -1 ? 1 : -1);
 }
+#else /* HAVE_INET_PTON */
+int ares_inet_pton(int af, const char *src, void *dst)
+{
+  /* just relay this to the underlying function */
+  return inet_pton(af, src, dst);
+}
+
 #endif
diff --git a/inet_net_pton.h b/inet_net_pton.h
deleted file mode 100644 (file)
index 5396a7f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef HEADER_CARES_INET_NET_PTON_H
-#define HEADER_CARES_INET_NET_PTON_H
-
-/* Copyright (C) 2005-2010 by Daniel Stenberg et al
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-#ifdef HAVE_INET_PTON
-#define ares_inet_pton(x,y,z) inet_pton(x,y,z)
-#else
-int ares_inet_pton(int af, const char *src, void *dst);
-#endif
-
-#ifdef HAVE_INET_NET_PTON
-#define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z)
-#else
-int ares_inet_net_pton(int af, const char *src, void *dst, size_t size);
-#endif
-
-#endif /* HEADER_CARES_INET_NET_PTON_H */
index ea1ebb8c57a9c61cab9c6150ce62dc78d8477ff8..77fe4a639b6676ba5c195808b81a9332263884b3 100644 (file)
@@ -34,8 +34,6 @@
 
 #include "ares.h"
 #include "ares_ipv6.h"
-#include "inet_ntop.h"
-
 
 #ifndef HAVE_INET_NTOP
 
@@ -61,7 +59,7 @@ static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size);
  *     Paul Vixie, 1996.
  */
 const char *
-ares_inet_ntop(int af, const void *src, char *dst, size_t size)
+ares_inet_ntop(int af, const void *src, char *dst, socklen_t size)
 {
   switch (af) {
   case AF_INET:
@@ -197,4 +195,11 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
   strcpy(dst, tmp);
   return (dst);
 }
-#endif
+#else /* HAVE_INET_NTOP */
+
+const char *ares_inet_ntop(int af, const void *src, char *dst, socklen_t size)
+{
+  /* just relay this to the underlying function */
+  return inet_ntop(af, src, dst, size);
+}
+#endif /* HAVE_INET_NTOP */
diff --git a/inet_ntop.h b/inet_ntop.h
deleted file mode 100644 (file)
index c583488..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef __ARES_INET_NTOP_H
-#define __ARES_INET_NTOP_H
-
-
-/* Copyright (C) 2005 by Dominick Meglio
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-#ifdef HAVE_INET_NTOP
-#define ares_inet_ntop(w,x,y,z) inet_ntop(w,x,y,z)
-#else
-const char *ares_inet_ntop(int af, const void *src, char *dst, size_t size);
-#endif
-
-#endif /* __ARES_INET_NTOP_H */