mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 02:42:58 +01:00
Merge pull request #4074 from ffontaine/master
src/compat.hpp: fix build with libbsd and strlcpy
This commit is contained in:
commit
b2a0842063
@ -250,10 +250,8 @@ if(NOT MSVC)
|
||||
set(ZMQ_HAVE_LIBBSD 1)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT WITH_LIBBSD OR NOT LIBBSD_FOUND)
|
||||
check_cxx_symbol_exists(strlcpy string.h ZMQ_HAVE_STRLCPY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Select curve encryption library, defaults to tweetnacl To use libsodium instead, use --with-libsodium(must be
|
||||
# installed) To disable curve, use --disable-curve
|
||||
|
@ -812,7 +812,6 @@ if test "x$enable_libbsd" != "xno"; then
|
||||
fi
|
||||
])
|
||||
fi
|
||||
if test "x$found_libbsd" != "xyes"; then
|
||||
AC_MSG_CHECKING([whether strlcpy is available])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
@ -825,7 +824,6 @@ if test "x$found_libbsd" != "xyes"; then
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
fi
|
||||
|
||||
# pthread_setname is non-posix, and there are at least 4 different implementations
|
||||
AC_MSG_CHECKING([whether signature of pthread_setname_np() has 1 argument])
|
||||
|
@ -37,9 +37,10 @@
|
||||
#define strcasecmp _stricmp
|
||||
#define strtok_r strtok_s
|
||||
#else
|
||||
#ifndef ZMQ_HAVE_STRLCPY
|
||||
#ifdef ZMQ_HAVE_LIBBSD
|
||||
#include <bsd/string.h>
|
||||
#elif !defined(ZMQ_HAVE_STRLCPY)
|
||||
#else
|
||||
static inline size_t
|
||||
strlcpy (char *dest_, const char *src_, const size_t dest_size_)
|
||||
{
|
||||
@ -50,6 +51,7 @@ strlcpy (char *dest_, const char *src_, const size_t dest_size_)
|
||||
return dest_size_ - remain;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
template <size_t size>
|
||||
static inline int strcpy_s (char (&dest_)[size], const char *const src_)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user