meson: Detect strlcat/strlcpy/reallocarray in libbsd

If we're linking with libbsd anyway, we might as well use the functions
it provides instead of compiling our replacements.

Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Peter Harris 2017-05-09 19:39:47 -04:00 committed by Adam Jackson
parent c4c002d1ca
commit 0ff2fb128b
2 changed files with 9 additions and 3 deletions

View File

@ -112,15 +112,15 @@ conf_data.set('HAVE_GETZONEID', cc.has_function('getzoneid'))
conf_data.set('HAVE_MMAP', cc.has_function('mmap'))
conf_data.set('HAVE_POLL', cc.has_function('poll'))
conf_data.set('HAVE_POSIX_FALLOCATE', cc.has_function('posix_fallocate'))
conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray'))
conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray', dependencies: libbsd_dep))
conf_data.set('HAVE_SETEUID', cc.has_function('seteuid'))
conf_data.set('HAVE_SETITIMER', cc.has_function('setitimer'))
conf_data.set('HAVE_SHMCTL64', cc.has_function('shmctl64'))
conf_data.set('HAVE_SIGACTION', cc.has_function('sigaction'))
conf_data.set('HAVE_STRCASECMP', cc.has_function('strcasecmp'))
conf_data.set('HAVE_STRCASESTR', cc.has_function('strcasestr'))
conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat'))
conf_data.set('HAVE_STRLCPY', cc.has_function('strlcpy'))
conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat', dependencies: libbsd_dep))
conf_data.set('HAVE_STRLCPY', cc.has_function('strlcpy', dependencies: libbsd_dep))
conf_data.set('HAVE_STRNCASECMP', cc.has_function('strncasecmp'))
conf_data.set('HAVE_STRNDUP', cc.has_function('strndup'))
conf_data.set('HAVE_TIMINGSAFE_MEMCMP', cc.has_function('timingsafe_memcmp'))

View File

@ -54,6 +54,12 @@ SOFTWARE.
#ifdef MONOTONIC_CLOCK
#include <time.h>
#endif
#if defined(HAVE_LIBBSD) && defined(HAVE_REALLOCARRAY)
#include <bsd/stdlib.h> /* for reallocarray */
#endif
#if defined(HAVE_LIBBSD) && defined(HAVE_STRLCPY)
#include <bsd/string.h> /* for strlcpy, strlcat */
#endif
#define SCREEN_SAVER_ON 0
#define SCREEN_SAVER_OFF 1