summaryrefslogtreecommitdiff
path: root/common/compat.h
blob: c292652ff959a5d555919c7a6979e4cc27d9410b (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

#ifndef _COMPAT_H_
#define _COMPAT_H_

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <sys/types.h>


#ifdef _DEBUG
    #include "assert.h"
    #define ASSERT assert
#else
    #define ASSERT
#endif

#ifndef HAVE_STDARG_H
#   error ERROR: Must have a working stdarg.h header
#else
#include <stdarg.h>
#endif

#ifndef HAVE_REALLOCF
void* reallocf(void* p, size_t sz);
#endif

#include <pthread.h>

/* TODO: Move this logic to configure */
#if HAVE_ERR_MUTEX == 1
#   define HA_MUTEX_TYPE PTHREAD_MUTEX_ERRORCHECK_NP
#else
#   if HAVE_ERR_MUTEX == 2
#       define HA_MUTEX_TYPE PTHREAD_MUTEX_ERRORCHECK
#   else
#       error "Need error checking mutex functionality"
#   endif
#endif

#ifndef HAVE_STRLWR
char* strlwr(char* s);
#endif

#ifndef HAVE_STRUPR
char* strupr(char* s);
#endif

#endif /* _COMPAT_H_ */