1 #ifndef GDHELPERS_H
2 #define GDHELPERS_H 1
3
4 #include <sys/types.h>
5 #include "php.h"
6
7
8
9 extern char *gd_strtok_r(char *s, char *sep, char **state);
10
11
12
13
14
15 #define gdCalloc(nmemb, size) ecalloc(nmemb, size)
16 #define gdMalloc(size) emalloc(size)
17 #define gdRealloc(ptr, size) erealloc(ptr, size)
18 #define gdEstrdup(ptr) estrdup(ptr)
19 #define gdFree(ptr) efree(ptr)
20 #define gdPMalloc(ptr) pemalloc(ptr, 1)
21 #define gdPFree(ptr) pefree(ptr, 1)
22 #define gdPEstrdup(ptr) pestrdup(ptr, 1)
23
24
25
26
27
28
29 int overflow2(int a, int b);
30
31 #ifdef ZTS
32 #define gdMutexDeclare(x) MUTEX_T x
33 #define gdMutexSetup(x) x = tsrm_mutex_alloc()
34 #define gdMutexShutdown(x) tsrm_mutex_free(x)
35 #define gdMutexLock(x) tsrm_mutex_lock(x)
36 #define gdMutexUnlock(x) tsrm_mutex_unlock(x)
37 #else
38 #define gdMutexDeclare(x)
39 #define gdMutexSetup(x)
40 #define gdMutexShutdown(x)
41 #define gdMutexLock(x)
42 #define gdMutexUnlock(x)
43 #endif
44
45 #endif
46