Crossfire Server, Trunk  R20608
compat.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define CALLOC(x, y)   calloc(x, y)
#define FALSE   false
#define FMT64   PRId64
#define FMT64U   PRIu64
#define MAX(x, y)   ((x) > (y) ? (x) : (y))
#define MIN(x, y)   ((x) < (y) ? (x) : (y))
#define object_decrease_nrof_by_one(xyz)   object_decrease_nrof(xyz, 1)
#define safe_strncpy   strlcpy
#define strcasestr_local   strcasestr
#define strdup_local   strdup
#define TRUE   true


void safe_strcat (char *dest, const char *orig, size_t *curlen, size_t maxlen)
char * strcasestr (const char *s, const char *find)
char * strdup (const char *str)
size_t strlcpy (char *dst, const char *src, size_t size)
char * tempnam (const char *tmpdir, const char *prefix)

Detailed Description

Compatibility implementations of useful nonstandard types and functions.

Definition in file compat.h.

Macro Definition Documentation

#define CALLOC (   x,
)    calloc(x, y)
#define FMT64U   PRIu64

Definition at line 13 of file compat.h.

Referenced by main(), pay_for_amount(), pay_for_item(), save_map(), and START_TEST().

#define strcasestr_local   strcasestr

Definition at line 24 of file compat.h.

Referenced by hiscore_display(), write_mark(), and write_note().

Function Documentation

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't overwrite that string.

deststring to append to.
origstring to append.
[out]curlencurrent length of dest. Will be updated by this function.
maxlenmaximum length of dest buffer.

Definition at line 346 of file porting.c.

Referenced by display_motd(), query_base_name(), query_name(), query_short_name(), send_new_char_info(), send_news(), and send_rules().

+ Here is the caller graph for this function:

char* strcasestr ( const char *  s,
const char *  find 

Finds a substring in a string, in a case-insensitive manner.

sstring we're searching into.
findstring we're searching for.
pointer to first occurrence of find in s, NULL if not found.

Definition at line 284 of file porting.c.

References strncasecmp(), and tolower.

+ Here is the call graph for this function:

size_t strlcpy ( char *  dst,
const char *  src,
size_t  size 

Portable implementation of strlcpy(3).

Definition at line 365 of file porting.c.

char* tempnam ( const char *  dir,
const char *  pfx 

Portable implementation of tempnam(3).

Do not use this function for new code, use tempnam_secure() instead.

Used to generate temporary unique name.

Definition at line 52 of file porting.c.

References F_OK, getpid, MAXPATHLEN, and snprintf.

Referenced by save_map(), and tempnam_secure().

+ Here is the caller graph for this function: