INN commit: trunk (6 files)

INN Commit rra at isc.org
Sat Aug 20 23:15:10 UTC 2011


    Date: Saturday, August 20, 2011 @ 16:15:10
  Author: eagle
Revision: 9356

Remove hstrerror replacement

This is no longer used anywhere in the source tree since all callers
now use getaddrinfo and its corresponding error message function
instead.

Modified:
  trunk/include/portable/socket.h
  trunk/lib/Makefile
  trunk/tests/Makefile
  trunk/tests/TESTS
Deleted:
  trunk/lib/hstrerror.c
  trunk/tests/lib/hstrerror-t.c

---------------------------+
 include/portable/socket.h |    3 ---
 lib/Makefile              |    5 +----
 lib/hstrerror.c           |   44 --------------------------------------------
 tests/Makefile            |    8 +-------
 tests/TESTS               |    1 -
 tests/lib/hstrerror-t.c   |   30 ------------------------------
 6 files changed, 2 insertions(+), 89 deletions(-)

Modified: include/portable/socket.h
===================================================================
--- include/portable/socket.h	2011-08-20 23:14:31 UTC (rev 9355)
+++ include/portable/socket.h	2011-08-20 23:15:10 UTC (rev 9356)
@@ -159,9 +159,6 @@
 #if !HAVE_DECL_H_ERRNO
 extern int h_errno;
 #endif
-#if !HAVE_HSTRERROR
-extern const char *hstrerror(int);
-#endif
 
 /* The netdb constants, which aren't always defined (particularly if h_errno
    isn't declared.  We also make sure that a few of the less-used ones are

Modified: lib/Makefile
===================================================================
--- lib/Makefile	2011-08-20 23:14:31 UTC (rev 9355)
+++ lib/Makefile	2011-08-20 23:15:10 UTC (rev 9356)
@@ -19,7 +19,7 @@
 
 # Sources for additional functions only built to replace missing system ones.
 EXTRA_SOURCES = alloca.c asprintf.c fseeko.c ftello.c getaddrinfo.c getnameinfo.c \
-		getpagesize.c hstrerror.c inet_aton.c inet_ntoa.c inet_ntop.c memcmp.c \
+		getpagesize.c inet_aton.c inet_ntoa.c inet_ntop.c memcmp.c \
 		mkstemp.c pread.c pwrite.c setenv.c seteuid.c setproctitle.c \
 		snprintf.c strcasecmp.c strlcat.c strlcpy.c strspn.c \
 		strtok.c symlink.c
@@ -322,9 +322,6 @@
   ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h
 getpagesize.o: getpagesize.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h
-hstrerror.o: hstrerror.c ../include/config.h ../include/inn/defines.h \
-  ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
-  ../include/config.h
 inet_aton.o: inet_aton.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h

Deleted: lib/hstrerror.c
===================================================================
--- lib/hstrerror.c	2011-08-20 23:14:31 UTC (rev 9355)
+++ lib/hstrerror.c	2011-08-20 23:15:10 UTC (rev 9356)
@@ -1,44 +0,0 @@
-/*  $Id$
-**
-**  Replacement for a missing hstrerror.
-**
-**  Written by Russ Allbery <rra at stanford.edu>
-**  This work is hereby placed in the public domain by its author.
-**
-**  Provides hstrerror (strerror, but for h_errno from the resolver
-**  libraries) on those platforms that don't have it (most non-BSD).  This
-**  function is thread-safe unless called with an unknown h_errno.
-*/
-
-#include "config.h"
-#include "clibrary.h"
-#include <netdb.h>
-
-static const char * const errors[] = {
-    "No resolver error",                /* 0 NETDB_SUCCESS */
-    "Unknown host",                     /* 1 HOST_NOT_FOUND */
-    "Host name lookup failure",         /* 2 TRY_AGAIN */
-    "Unknown server error",             /* 3 NO_RECOVERY */
-    "No address associated with name",  /* 4 NO_ADDRESS / NO_DATA */
-};
-static int nerrors = (sizeof errors / sizeof errors[0]);
-
-/* If we're running the test suite, rename hstrerror to avoid conflicts with
-   the system version. */
-#if TESTING
-# define hstrerror test_hstrerror
-const char *test_hstrerror(int);
-#endif
-
-const char *
-hstrerror(int error)
-{
-    static char buf[32];
-
-    if (error == -1)
-        return "Internal resolver error";
-    if (error >= 0 && error < nerrors)
-        return errors[error];
-    snprintf(buf, sizeof(buf), "Resolver error %d", error);
-    return buf;
-}

Modified: tests/Makefile
===================================================================
--- tests/Makefile	2011-08-20 23:14:31 UTC (rev 9355)
+++ tests/Makefile	2011-08-20 23:15:10 UTC (rev 9356)
@@ -14,7 +14,7 @@
 TESTS	= authprogs/ident.t innd/artparse.t innd/chan.t lib/asprintf.t \
 	lib/buffer.t lib/concat.t lib/conffile.t lib/confparse.t lib/date.t \
 	lib/dispatch.t lib/getaddrinfo.t lib/getnameinfo.t lib/hash.t \
-	lib/hashtab.t lib/hex.t lib/hstrerror.t lib/inet_aton.t \
+	lib/hashtab.t lib/hex.t lib/inet_aton.t \
 	lib/inet_ntoa.t lib/inet_ntop.t lib/innconf.t lib/list.t lib/md5.t \
 	lib/memcmp.t lib/messages.t lib/mkstemp.t lib/network.t lib/pread.t \
 	lib/pwrite.t lib/qio.t lib/snprintf.t lib/strlcat.t \
@@ -120,12 +120,6 @@
 lib/hashtab.t: lib/hashtab-t.o libtest.o $(LIBINN)
 	$(LINK) lib/hashtab-t.o libtest.o $(LIBINN)
 
-lib/hstrerror.o: ../lib/hstrerror.c
-	$(CC) $(CFLAGS) -DTESTING -c -o $@ ../lib/hstrerror.c
-
-lib/hstrerror.t: lib/hstrerror.o lib/hstrerror-t.o libtest.o $(LIBINN)
-	$(LINK) lib/hstrerror.o lib/hstrerror-t.o libtest.o $(LIBINN)
-
 lib/hex.t: lib/hex-t.o libtest.o $(LIBINN)
 	$(LINK) lib/hex-t.o libtest.o $(LIBINN) $(LIBS)
 

Modified: tests/TESTS
===================================================================
--- tests/TESTS	2011-08-20 23:14:31 UTC (rev 9355)
+++ tests/TESTS	2011-08-20 23:15:10 UTC (rev 9356)
@@ -16,7 +16,6 @@
 lib/hash
 lib/hashtab
 lib/hex
-lib/hstrerror
 lib/inet_aton
 lib/inet_ntoa
 lib/inet_ntop

Deleted: tests/lib/hstrerror-t.c
===================================================================
--- tests/lib/hstrerror-t.c	2011-08-20 23:14:31 UTC (rev 9355)
+++ tests/lib/hstrerror-t.c	2011-08-20 23:15:10 UTC (rev 9356)
@@ -1,30 +0,0 @@
-/* $Id$ */
-/* hstrerror test suite. */
-
-#include "config.h"
-#include <netdb.h>
-#include <stdio.h>
-
-#include "libtest.h"
-
-const char *test_hstrerror(int);
-
-static void
-test_error(int n, const char *expected, int error)
-{
-    ok_string(n, expected, test_hstrerror(error));
-}
-
-int
-main(void)
-{
-    test_init(5);
-
-    test_error(1, "Internal resolver error", -1);
-    test_error(2, "No resolver error", 0);
-    test_error(3, "No address associated with name", NO_ADDRESS);
-    test_error(4, "Resolver error 777777", 777777);
-    test_error(5, "Resolver error -99999", -99999);
-
-    return 0;
-}




More information about the inn-committers mailing list