From 0f3d4f4a19cc81d468a733f1354efe1b12d967cb Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 18 Jun 2012 09:52:19 +0200 Subject: [PATCH] libxbps: hide compat symbols. --- include/compat.h | 9 +++++---- include/xbps_api_impl.h | 22 +++++++++++----------- lib/compat/strcasestr.c | 2 +- lib/compat/strlcat.c | 2 +- lib/compat/strlcpy.c | 2 +- lib/compat/vasprintf.c | 2 +- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/include/compat.h b/include/compat.h index 8b3186bf..9d0085ff 100644 --- a/include/compat.h +++ b/include/compat.h @@ -3,21 +3,22 @@ #include #include +#include "xbps_api_impl.h" #ifndef HAVE_STRLCAT -size_t strlcat(char *, const char *, size_t); +size_t HIDDEN strlcat(char *, const char *, size_t); #endif #ifndef HAVE_STRLCPY -size_t strlcpy(char *, const char *, size_t); +size_t HIDDEN strlcpy(char *, const char *, size_t); #endif #ifndef HAVE_STRCASESTR -char *strcasestr(const char *, const char *); +char HIDDEN *strcasestr(const char *, const char *); #endif #if defined(HAVE_VASPRINTF) && !defined(_GNU_SOURCE) -int vasprintf(char **, const char *, va_list); +int HIDDEN vasprintf(char **, const char *, va_list); #endif #endif /* COMPAT_H */ diff --git a/include/xbps_api_impl.h b/include/xbps_api_impl.h index 62a50a36..01441913 100644 --- a/include/xbps_api_impl.h +++ b/include/xbps_api_impl.h @@ -29,6 +29,17 @@ #include #include +/* + * By default all public functions have default visibility, unless + * visibility has been detected by configure and the HIDDEN definition + * is used. + */ +#if HAVE_VISIBILITY +#define HIDDEN __attribute__ ((visibility("hidden"))) +#else +#define HIDDEN +#endif + #include "compat.h" #include "queue.h" #include "fetch.h" @@ -45,17 +56,6 @@ #define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) #endif -/* - * By default all public functions have default visibility, unless - * visibility has been detected by configure and the HIDDEN definition - * is used. - */ -#if HAVE_VISIBILITY -#define HIDDEN __attribute__ ((visibility("hidden"))) -#else -#define HIDDEN -#endif - __BEGIN_DECLS /** diff --git a/lib/compat/strcasestr.c b/lib/compat/strcasestr.c index 6a662cc8..e7861c27 100644 --- a/lib/compat/strcasestr.c +++ b/lib/compat/strcasestr.c @@ -40,7 +40,7 @@ /* * Find the first occurrence of find in s, ignore case. */ -char * +char HIDDEN * strcasestr(const char *s, const char *find) { char c, sc; diff --git a/lib/compat/strlcat.c b/lib/compat/strlcat.c index 836e3929..ff273114 100644 --- a/lib/compat/strlcat.c +++ b/lib/compat/strlcat.c @@ -28,7 +28,7 @@ * Returns strlen(src) + MIN(siz, strlen(initial dst)). * If retval >= siz, truncation occurred. */ -size_t +size_t HIDDEN strlcat(char *dst, const char *src, size_t siz) { char *d = dst; diff --git a/lib/compat/strlcpy.c b/lib/compat/strlcpy.c index b87eb8d4..0915199a 100644 --- a/lib/compat/strlcpy.c +++ b/lib/compat/strlcpy.c @@ -26,7 +26,7 @@ * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen(src); if retval >= siz, truncation occurred. */ -size_t +size_t HIDDEN strlcpy(char *dst, const char *src, size_t siz) { char *d = dst; diff --git a/lib/compat/vasprintf.c b/lib/compat/vasprintf.c index a9bf0df6..d73892e0 100644 --- a/lib/compat/vasprintf.c +++ b/lib/compat/vasprintf.c @@ -33,7 +33,7 @@ #include #include -int +int HIDDEN vasprintf(char **ret, const char *fmt, va_list ap) { char *buf, *new_buf;