Crossfire Server, Trunk
compat.h File Reference
#include <string.h>
+ Include dependency graph for compat.h:
+ 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)
size_t strlcpy (char *dst, const char *src, size_t size)

Detailed Description

Compatibility implementations of useful nonstandard types and functions.

Definition in file compat.h.

Macro Definition Documentation


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

Definition at line 31 of file compat.h.


#define FALSE   false

Definition at line 14 of file compat.h.

◆ FMT64

#define FMT64   PRId64

Definition at line 16 of file compat.h.

◆ FMT64U

#define FMT64U   PRIu64

Definition at line 17 of file compat.h.


#define MAX (   x,
)    ((x) > (y) ? (x) : (y))

Definition at line 24 of file compat.h.


#define MIN (   x,
)    ((x) < (y) ? (x) : (y))

Definition at line 21 of file compat.h.

◆ object_decrease_nrof_by_one

#define object_decrease_nrof_by_one (   xyz)    object_decrease_nrof(xyz, 1)

Definition at line 32 of file compat.h.

◆ safe_strncpy

#define safe_strncpy   strlcpy

Definition at line 27 of file compat.h.

◆ strcasestr_local

#define strcasestr_local   strcasestr

Definition at line 28 of file compat.h.

◆ strdup_local

#define strdup_local   strdup

Definition at line 29 of file compat.h.


#define TRUE   true

Definition at line 11 of file compat.h.

Function Documentation

◆ safe_strcat()

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 202 of file porting.cpp.

References convert::dest.

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

+ Here is the caller graph for this function:

◆ strlcpy()