aboutsummaryrefslogtreecommitdiff
path: root/compat/compat.h
blob: 5f9424d62c020226931cf0867e2c8d8a0216a8b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// compat.h
// Compatibility layer for functions not in standard C99

#ifndef MOSLIB_COMPAT_H
#define MOSLIB_COMPAT_H

#define _GNU_SOURCE

// In C99 TU needs a declaration (which won't be the case if all functions are available)
typedef void mos_compat_decl;

#ifndef NO_STRDUP
#define mos_strdup strdup
#else
extern char *mos_strdup(const char *s);
#endif // NO_STRDUP

#ifndef NO_MEMMEM
#define mos_memmem memmem
#else
#include <stddef.h>
extern void *mos_memmem(const void *h, size_t h_size, const void *n, size_t n_size);
#endif // NO_MEMMEM

#endif // MOSLIB_COMPAT_H