From 16d9e30dd7fa052bd7e6dd37927d7f27bec90ef1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 19 Oct 2005 00:10:02 +0000 Subject: * Compile tests only when --enable-tests was specified on the configure command line * Build compat layers only when --enable-compat-{howl,libdns_sd} was passed to configure * drop avahi_strlcpy() to reduce our code/API size * replace getifname() with if_indextoname in avahi-dnsconfd * declare environ if needed in avahi-dnsconfd * drop some useless definitions like AVAHI_PUBLISH_NULL = 0 git-svn-id: file:///home/lennart/svn/public/avahi/trunk@819 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-common/Makefile.am | 2 ++ avahi-common/defs.h | 3 --- avahi-common/domain.c | 21 ++++++++++++--------- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'avahi-common') diff --git a/avahi-common/Makefile.am b/avahi-common/Makefile.am index 972e9ad..670c855 100644 --- a/avahi-common/Makefile.am +++ b/avahi-common/Makefile.am @@ -40,12 +40,14 @@ avahi_commoninclude_HEADERS = \ llist.h \ rlist.h +if ENABLE_TESTS noinst_PROGRAMS = \ strlst-test \ domain-test \ alternative-test \ timeval-test \ watch-test +endif lib_LTLIBRARIES = \ libavahi-common.la diff --git a/avahi-common/defs.h b/avahi-common/defs.h index 67bdddc..3b8c2a5 100644 --- a/avahi-common/defs.h +++ b/avahi-common/defs.h @@ -154,7 +154,6 @@ typedef enum { /** Some flags for publishing functions */ typedef enum { - AVAHI_PUBLISH_NULL = 0, AVAHI_PUBLISH_UNIQUE = 1, /**< For raw records: The RRset is intended to be unique */ AVAHI_PUBLISH_NO_PROBE = 2, /**< For raw records: Though the RRset is intended to be unique no probes shall be sent */ AVAHI_PUBLISH_NO_ANNOUNCE = 4, /**< For raw records: Do not announce this RR to other hosts */ @@ -166,7 +165,6 @@ typedef enum { /** Some flags for lookup functions */ typedef enum { - AVAHI_LOOKUP_NULL = 0, AVAHI_LOOKUP_USE_WIDE_AREA = 1, /**< Force lookup via wide area DNS */ AVAHI_LOOKUP_USE_MULTICAST = 2, /**< Force lookup via multicast DNS */ AVAHI_LOOKUP_NO_TXT = 4, /**< When doing service resolving, don't lookup TXT record */ @@ -175,7 +173,6 @@ typedef enum { /** Some flags for lookup callback functions */ typedef enum { - AVAHI_LOOKUP_RESULT_NULL = 0, AVAHI_LOOKUP_RESULT_CACHED = 1, /**< This response originates from the cache */ AVAHI_LOOKUP_RESULT_WIDE_AREA = 2, /**< This response originates from wide area DNS */ AVAHI_LOOKUP_RESULT_MULTICAST = 4, /**< This response originates from multicast DNS */ diff --git a/avahi-common/domain.c b/avahi-common/domain.c index f2e4395..e82411f 100644 --- a/avahi-common/domain.c +++ b/avahi-common/domain.c @@ -530,19 +530,22 @@ int avahi_service_name_join(char *p, size_t size, const char *name, const char * return AVAHI_OK; } +#ifndef HAVE_STRLCPY -char *avahi_strlcpy(char *dest, const char *src, size_t n) { +static size_t strlcpy(char *dest, const char *src, size_t n) { assert(dest); assert(src); - - if (n == 0) - return dest; - - strncpy(dest, src, n-1); - dest[n-1] = 0; - return dest; + + if (n > 0) { + strncpy(dest, src, n-1); + dest[n-1] = 0; + } + + return strlen(src); } +#endif + int avahi_service_name_split(const char *p, char *name, size_t name_size, char *type, size_t type_size, char *domain, size_t domain_size) { enum { NAME, @@ -574,7 +577,7 @@ int avahi_service_name_split(const char *p, char *name, size_t name_size, char * switch (state) { case NAME: - avahi_strlcpy(name, buf, name_size); + strlcpy(name, buf, name_size); state = TYPE; break; -- cgit