comparison libmlk-core/core/port.h @ 313:dbfe05b88627

cmake: bring back for good It's just too complicated to get portability done right using pure GNU make and since we're targeting more OSes than Linux we have to incorporate some portability bits.
author David Demelier <markand@malikania.fr>
date Wed, 22 Sep 2021 07:19:32 +0200
parents 0858e33a762d
children d01e83210ca2
comparison
equal deleted inserted replaced
312:4ea0f035f712 313:dbfe05b88627
17 */ 17 */
18 18
19 #ifndef MOLKO_CORE_PORT_H 19 #ifndef MOLKO_CORE_PORT_H
20 #define MOLKO_CORE_PORT_H 20 #define MOLKO_CORE_PORT_H
21 21
22 #include "config.h"
23
22 /* {{{ strlcpy (BSD extension, incoming in next POSIX). */ 24 /* {{{ strlcpy (BSD extension, incoming in next POSIX). */
23 25
24 #if defined(_WIN32) 26 #if !defined(MLK_HAS_STRLCPY)
25 # define MOLKO_PORT_NEED_STRLCPY
26 #endif
27
28 #if defined(MOLKO_PORT_NEED_STRLCPY)
29 27
30 #include <stddef.h> 28 #include <stddef.h>
31 29
32 size_t 30 size_t
33 strlcpy(char *, const char *, size_t); 31 strlcpy(char *, const char *, size_t);
34 32
35 #endif 33 #endif /* !MLK_HAS_STRLCPY */
36 34
37 /* }}} */ 35 /* }}} */
38 36
39 /* {{{ fmemopen (POSIX). */ 37 /* {{{ fmemopen (POSIX). */
40 38
41 #if defined(_WIN32) 39 #if !defined(MLK_HAS_FMEMOPEN)
42 # define MOLKO_PORT_NEED_FMEMOPEN
43 #endif
44
45 #if defined(MOLKO_PORT_NEED_FMEMOPEN)
46 40
47 #include <stdio.h> 41 #include <stdio.h>
48 42
49 FILE * 43 FILE *
50 fmemopen(void *, size_t, const char *); 44 fmemopen(void *, size_t, const char *);
51 45
52 #endif 46 #endif /* !MLK_HAS_FMEMOPEN */
53 47
54 /* }}} */ 48 /* }}} */
55 49
56 #endif /* !MOLKO_CORE_PORT_H */ 50 #endif /* !MOLKO_CORE_PORT_H */