Remove getaddrinfo compat implementation completely

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Remove getaddrinfo compat implementation completely

Arnout Vandecappelle (Essensium/Mind)
 Hi all,

 When I posted a patch on the list to fix the compat handling of getaddrinfo,
the conclusion was that it would be better to get rid of the compat handling
of getaddrinfo completely. However my patch to do that didn't make it to the
list because it was too large. So my original patch got applied instead.

 Therefore, here is the patch to remove the compat handling of getaddrinfo
again. It is rebased on current master. This time I made it with the -D
option so it's a lot smaller.

 Regards,
 Arnout


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

[PATCH] Remove compat getaddrinfo implementation

Arnout Vandecappelle (Essensium/Mind)
compat_netdb.h causes compilation failures with the uClibc C library,
because uClibc doesn't have the rpc/netdb.h header. That is in fact a
glibc-internal implementation file. It is included by compat_netdb.h
because compat_netdb.h is just a copy from glibc's netdb.h.

However, compat_netdb.h and getaddrinfo.c only exist to provide an
implementation on platforms that don't natively provide getaddrinfo or
inet_ntop, like Solaris 7. However, Solaris 8 (released in 2000) and
all other POSIX-2001 platforms (MacOS, Windows) do provide it.

Therefore, remove compat_netdb.h and getaddrinfo.c completely, and
add an error to configure if getaddrinfo or inet_ntop are not found.
Also remove the check for inet_pton, which is no longer used anywhere.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[hidden email]>
---
 configure.ac                              |    7 +-
 module/owlib/src/c/Makefile.am            |    1 -
 module/owlib/src/c/getaddrinfo.c          | 1145 -----------------------------
 module/owlib/src/include/Makefile.am      |    1 -
 module/owlib/src/include/compat.h         |    1 -
 module/owlib/src/include/compat_netdb.h   |  195 -----
 module/ownet/c/src/c/Makefile.am          |    1 -
 module/ownet/c/src/c/getaddrinfo.c        | 1145 -----------------------------
 module/ownet/c/src/include/Makefile.am    |    1 -
 module/ownet/c/src/include/compat.h       |    1 -
 module/ownet/c/src/include/compat_netdb.h |  195 -----
 module/owshell/src/c/Makefile.am          |    1 -
 module/owshell/src/c/getaddrinfo.c        | 1145 -----------------------------
 13 files changed, 6 insertions(+), 3833 deletions(-)
 delete mode 100644 module/owlib/src/c/getaddrinfo.c
 delete mode 100644 module/owlib/src/include/compat_netdb.h
 delete mode 100644 module/ownet/c/src/c/getaddrinfo.c
 delete mode 100644 module/ownet/c/src/include/compat_netdb.h
 delete mode 100644 module/owshell/src/c/getaddrinfo.c

diff --git a/configure.ac b/configure.ac
index 1c8f7e0..217f67c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1640,7 +1640,12 @@ AC_FUNC_SELECT_ARGTYPES
 AC_FUNC_STRFTIME
 AC_FUNC_STRTOD
 AC_TYPE_SIGNAL
-AC_CHECK_FUNCS([accept daemon getaddrinfo freeaddrinfo gethostbyname2_r gethostbyaddr_r gethostbyname_r getservbyname_r getopt getopt_long gmtime_r gettimeofday localtime_r inet_ntop inet_pton memchr memset select socket strcasecmp strchr strdup strncasecmp strtol strtoul twalk tsearch tfind tdelete tdestroy vasprintf strsep vsprintf vsnprintf writev getline])
+AC_CHECK_FUNCS([accept daemon getaddrinfo freeaddrinfo gethostbyname2_r gethostbyaddr_r gethostbyname_r getservbyname_r getopt getopt_long gmtime_r gettimeofday localtime_r inet_ntop memchr memset select socket strcasecmp strchr strdup strncasecmp strtol strtoul twalk tsearch tfind tdelete tdestroy vasprintf strsep vsprintf vsnprintf writev getline])
+
+if test "x${ac_cv_func_getaddrinfo}" != "xyes" -o \
+ "x${ac_cv_func_inet_ntop}" != "xyes"; then
+ AC_MSG_ERROR([getaddrinfo() and inet_ntop() are required])
+fi
 
 save_LIBS="$LIBS"
 LIBS=""
diff --git a/module/owlib/src/c/Makefile.am b/module/owlib/src/c/Makefile.am
index 62ecf35..a450a5f 100644
--- a/module/owlib/src/c/Makefile.am
+++ b/module/owlib/src/c/Makefile.am
@@ -5,7 +5,6 @@ OWLIB_SOURCE = ow_dl.c            \
                ow_bitfield.c      \
                ow_byte.c          \
                compat.c           \
-               getaddrinfo.c      \
                getline.c          \
                timegm.c           \
                getopt.c           \
diff --git a/module/owlib/src/c/getaddrinfo.c b/module/owlib/src/c/getaddrinfo.c
deleted file mode 100644
index 091cc06..0000000
diff --git a/module/owlib/src/include/Makefile.am b/module/owlib/src/include/Makefile.am
index 457ca5a..1bfb860 100644
--- a/module/owlib/src/include/Makefile.am
+++ b/module/owlib/src/include/Makefile.am
@@ -2,7 +2,6 @@ noinst_HEADERS =           \
         compat_getopt.h    \
         compat.h           \
         i2c-dev.h          \
-        compat_netdb.h     \
         connector.h        \
         jsmn.h             \
         ow.h               \
diff --git a/module/owlib/src/include/compat.h b/module/owlib/src/include/compat.h
index e95e16f..b653983 100644
--- a/module/owlib/src/include/compat.h
+++ b/module/owlib/src/include/compat.h
@@ -58,7 +58,6 @@
 #endif
 
 #ifndef HAVE_GETADDRINFO
-#include "compat_netdb.h"
 #endif
 #include "compat_getopt.h"
 
diff --git a/module/owlib/src/include/compat_netdb.h b/module/owlib/src/include/compat_netdb.h
deleted file mode 100644
index 6f7df26..0000000
diff --git a/module/ownet/c/src/c/Makefile.am b/module/ownet/c/src/c/Makefile.am
index ffef133..5ba2f6d 100644
--- a/module/ownet/c/src/c/Makefile.am
+++ b/module/ownet/c/src/c/Makefile.am
@@ -1,7 +1,6 @@
 LIBOWNET_SOURCE =    \
         compat.c        \
         error.c         \
-        getaddrinfo.c   \
         getopt.c        \
         globals.c       \
         ow_browse.c     \
diff --git a/module/ownet/c/src/c/getaddrinfo.c b/module/ownet/c/src/c/getaddrinfo.c
deleted file mode 100644
index 2009550..0000000
diff --git a/module/ownet/c/src/include/Makefile.am b/module/ownet/c/src/include/Makefile.am
index 657732d..3089768 100644
--- a/module/ownet/c/src/include/Makefile.am
+++ b/module/ownet/c/src/include/Makefile.am
@@ -4,7 +4,6 @@ header_DATA = ownetapi.h
 EXTRA_DIST = ${header_DATA} \
         compat_getopt.h   \
         compat.h          \
-        compat_netdb.h    \
         ow_charblob.h     \
         ow_connection.h   \
         ow_debug.h        \
diff --git a/module/ownet/c/src/include/compat.h b/module/ownet/c/src/include/compat.h
index f8ae759..0244171 100644
--- a/module/ownet/c/src/include/compat.h
+++ b/module/ownet/c/src/include/compat.h
@@ -59,7 +59,6 @@ $Id$
 #endif
 
 #ifndef HAVE_GETADDRINFO
-#include "compat_netdb.h"
 #endif
 #include "compat_getopt.h"
 
diff --git a/module/ownet/c/src/include/compat_netdb.h b/module/ownet/c/src/include/compat_netdb.h
deleted file mode 100644
index 6f7df26..0000000
diff --git a/module/owshell/src/c/Makefile.am b/module/owshell/src/c/Makefile.am
index 38d3600..7d774f7 100644
--- a/module/owshell/src/c/Makefile.am
+++ b/module/owshell/src/c/Makefile.am
@@ -6,7 +6,6 @@ COMMON_OWSHELL_SOURCE = ow_opt.c   \
                ow_dl.c      \
                ow_dnssd.c   \
                ow_tcp_read.c\
-               getaddrinfo.c\
                getopt.c     \
                globals.c
 
diff --git a/module/owshell/src/c/getaddrinfo.c b/module/owshell/src/c/getaddrinfo.c
deleted file mode 100644
index 543ece7..0000000
--
2.8.0.rc3


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers