Crossfire Server, Trunk  R20513
compat.h
Go to the documentation of this file.
1 
6 #ifndef _COMPAT_H
7 #define _COMPAT_H
8 
9 // Maintain backward compatibility with original macros.
10 #define TRUE true
11 #define FALSE false
12 #define FMT64 PRId64
13 #define FMT64U PRIu64
14 
15 
16 #ifndef MIN
17 #define MIN(x, y) ((x) < (y) ? (x) : (y))
18 #endif
19 #ifndef MAX
20 #define MAX(x, y) ((x) > (y) ? (x) : (y))
21 #endif
22 
23 #define safe_strncpy strlcpy
24 #define strcasestr_local strcasestr
25 #define strdup_local strdup
26 
27 #define CALLOC(x, y) calloc(x, y)
28 #define object_decrease_nrof_by_one(xyz) object_decrease_nrof(xyz, 1)
29 
30 void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen);
31 
32 #ifndef HAVE_STRCASESTR
33 char *strcasestr(const char *s, const char *find);
34 #endif
35 
36 #ifndef HAVE_STRDUP
37 char *strdup(const char *str);
38 #endif
39 
40 #ifndef HAVE_STRLCPY
41 size_t strlcpy(char *dst, const char *src, size_t size);
42 #endif
43 
44 #ifndef HAVE_TEMPNAM
45 char *tempnam(const char *tmpdir, const char *prefix);
46 #endif
47 
48 #endif
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
Simple function we use below to keep adding to the same string but also make sure we don&#39;t overwrite ...
Definition: porting.c:346
size_t strlcpy(char *dst, const char *src, size_t size)
Portable implementation of strlcpy(3).
Definition: porting.c:365
char * strcasestr(const char *s, const char *find)
Finds a substring in a string, in a case-insensitive manner.
Definition: porting.c:284
char * strdup(const char *str)
Portable implementation of strdup(3).
Definition: porting.c:200
char * tempnam(const char *tmpdir, const char *prefix)
Portable implementation of tempnam(3).
Definition: porting.c:52