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/domain.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'avahi-common/domain.c') 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