Fix strlcpy/strlcat error on macOS

This commit is contained in:
Zeex 2017-12-30 22:14:22 +06:00
parent a90969b6c3
commit 047fdbba3b
2 changed files with 10 additions and 13 deletions

View File

@ -5,6 +5,7 @@
* (there is no need to include the same files twice).
*/
#include <string.h> /* for strlen() */
#include "lstring.h"
#if !defined HAVE_STRLCPY
@ -27,11 +28,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
#include <sys/types.h> already included through lstring.h
*/
#include <string.h> /* for strlen() */
/*
* Copy src to string dst of size siz. At most siz-1 characters
* will be copied. Always NUL terminates (unless siz == 0).
@ -85,11 +81,6 @@ strlcpy(char *dst, const char *src, size_t siz)
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
#include <sys/types.h> already included
#include <string.h> already included
*/
/*
* Appends src to string dst of size siz (unlike strncat, siz is the
* full size of dst, not space left). At most siz-1 characters

View File

@ -2,12 +2,18 @@
#include <stddef.h>
#if (defined __WATCOMC__ && __WATCOMC__ >= 1240)
/* OpenWatcom introduced BSD "safe string functions" with version 1.4 */
|| defined __APPLE__
#if defined __WATCOMC__ && __WATCOMC__ >= 1240
/* OpenWatcom introduced BSD "safe string functions" with version 1.4 */
#define HAVE_SAFESTR
#endif
#if defined strlcpy
#define HAVE_STRLCPY
#endif
#if defined strlcat
#define HAVE_STRLCAT
#endif
#if defined HAVE_SAFESTR
#define HAVE_STRLCPY
#define HAVE_STRLCAT