fixing MacOS X build
authorVolker Birk <vb@pep-project.org>
Tue, 26 Jul 2016 11:03:29 +0200
changeset 92695247f30b919
parent 922 96ca717a851f
child 927 d8e8021de786
child 928 c87f1fdaff36
child 1123 65d39d3f13e6
fixing MacOS X build
src/message_api.c
src/platform_unix.c
src/platform_unix.h
     1.1 --- a/src/message_api.c	Fri Jul 22 18:13:49 2016 +0200
     1.2 +++ b/src/message_api.c	Tue Jul 26 11:03:29 2016 +0200
     1.3 @@ -8,6 +8,7 @@
     1.4  #include <string.h>
     1.5  #include <stdlib.h>
     1.6  
     1.7 +
     1.8  #ifndef MIN
     1.9  #define MIN(A, B) ((B) > (A) ? (A) : (B))
    1.10  #endif
     2.1 --- a/src/platform_unix.c	Fri Jul 22 18:13:49 2016 +0200
     2.2 +++ b/src/platform_unix.c	Tue Jul 26 11:03:29 2016 +0200
     2.3 @@ -94,8 +94,8 @@
     2.4  }
     2.5  #endif
     2.6  
     2.7 -#ifndef BSD
     2.8 -#if !TARGET_OS_IPHONE
     2.9 +#if !defined(BSD) && !defined(__APPLE__)
    2.10 +
    2.11  size_t strlcpy(char* dst, const	char* src, size_t size) {
    2.12      size_t retval = strlen(src);
    2.13      size_t size_to_copy = (retval < size ? retval : size - 1);
    2.14 @@ -106,6 +106,7 @@
    2.15      dst[size_to_copy] = '\0';
    2.16      return retval;
    2.17  }
    2.18 +
    2.19  size_t strlcat(char* dst, const	char* src, size_t size) {
    2.20      size_t start_len = strnlen(dst, size);
    2.21      if (start_len == size)
    2.22 @@ -121,7 +122,7 @@
    2.23      dst[start_len + size_to_copy] = '\0';
    2.24      return retval;
    2.25  }
    2.26 -#endif
    2.27 +
    2.28  #endif
    2.29  
    2.30  const char *unix_local_db(void)
     3.1 --- a/src/platform_unix.h	Fri Jul 22 18:13:49 2016 +0200
     3.2 +++ b/src/platform_unix.h	Tue Jul 26 11:03:29 2016 +0200
     3.3 @@ -1,4 +1,6 @@
     3.4 +#ifndef __APPLE__
     3.5  #define _POSIX_C_SOURCE 200809L
     3.6 +#endif
     3.7  
     3.8  #include <unistd.h>
     3.9  #include <strings.h>
    3.10 @@ -38,12 +40,10 @@
    3.11  #endif
    3.12  #endif
    3.13  
    3.14 -#ifndef BSD
    3.15 -#if !TARGET_OS_IPHONE
    3.16 +#if !defined(BSD) && !defined(__APPLE__)
    3.17  size_t strlcpy(char* dst, const	char* src, size_t size);
    3.18  size_t strlcat(char* dst, const	char* src, size_t size);
    3.19  #endif
    3.20 -#endif
    3.21  
    3.22  #ifdef __cplusplus
    3.23  }