diff options
Diffstat (limited to 'src/common/strlib.h')
-rw-r--r-- | src/common/strlib.h | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/common/strlib.h b/src/common/strlib.h index 5ef455a0e..10844d257 100644 --- a/src/common/strlib.h +++ b/src/common/strlib.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _STRLIB_H_ -#define _STRLIB_H_ +#ifndef _COMMON_STRLIB_H_ +#define _COMMON_STRLIB_H_ #include "../common/cbasetypes.h" #include <stdarg.h> @@ -70,13 +70,11 @@ struct strlib_interface { char *(*normalize_name) (char* str,const char* delims); const char *(*stristr) (const char *haystack, const char *needle); -#if !(defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400) && !defined(HAVE_STRNLEN) + /* only used when '!(defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400) && !defined(HAVE_STRNLEN)', needs to be defined at all times however */ size_t (*strnlen) (const char* string, size_t maxlen); -#endif - -#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER <= 1200 + + /* only used when 'defined(WIN32) && defined(_MSC_VER) && _MSC_VER <= 1200', needs to be defined at all times however */ uint64 (*strtoull) (const char* str, char** endptr, int base); -#endif int (*e_mail_check) (char* email); int (*config_switch) (const char* str); @@ -168,28 +166,29 @@ void strlib_defaults(void); /* the purpose of these macros is simply to not make calling them be an annoyance */ #ifndef STRLIB_C - #define jstrescape(pt) strlib->jstrescape(pt) - #define jstrescapecpy(pt,spt) strlib->jstrescapecpy(pt,spt) - #define jmemescapecpy(pt,spt,size) strlib->jmemescapecpy(pt,spt,size) - #define remove_control_chars(str) strlib->remove_control_chars(str) - #define trim(str) strlib->trim(str) - #define normalize_name(str,delims) strlib->normalize_name(str,delims) - #define stristr(haystack,needle) strlib->stristr(haystack,needle) + #define jstrescape(pt) (strlib->jstrescape(pt)) + #define jstrescapecpy(pt,spt) (strlib->jstrescapecpy((pt),(spt))) + #define jmemescapecpy(pt,spt,size) (strlib->jmemescapecpy((pt),(spt),(size))) + #define remove_control_chars(str) (strlib->remove_control_chars(str)) + #define trim(str) (strlib->trim(str)) + #define normalize_name(str,delims) (strlib->normalize_name((str),(delims))) + #define stristr(haystack,needle) (strlib->stristr((haystack),(needle))) #if !(defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400) && !defined(HAVE_STRNLEN) - #define strnln(string,maxlen) strlib->strnlen(string,maxlen) + #define strnlen(string,maxlen) (strlib->strnlen((string),(maxlen))) #endif #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER <= 1200 - #define strtoull(str,endptr,base) strlib->strtoull(str,endptr,base) + #define strtoull(str,endptr,base) (strlib->strtoull((str),(endptr),(base))) #endif - #define e_mail_check(email) strlib->e_mail_check(email) - #define config_switch(str) strlib->config_switch(str) - #define safestrncpy(dst,src,n) strlib->safestrncpy(dst,src,n) - #define safestrnlen(string,maxlen) strlib->safestrnlen(string,maxlen) - #define safesnprintf(buf,sz,fmt,...) strlib->safesnprintf(buf,sz,fmt,##__VA_ARGS__) - #define strline(str,pos) strlib->strline(str,pos) - #define bin2hex(output,input,count) strlib->bin2hex(output,input,count) + #define e_mail_check(email) (strlib->e_mail_check(email)) + #define config_switch(str) (strlib->config_switch(str)) + #define safestrncpy(dst,src,n) (strlib->safestrncpy((dst),(src),(n))) + #define safestrnlen(string,maxlen) (strlib->safestrnlen((string),(maxlen))) + #define safesnprintf(buf,sz,fmt,...) (strlib->safesnprintf((buf),(sz),(fmt),##__VA_ARGS__)) + #define strline(str,pos) (strlib->strline((str),(pos))) + #define bin2hex(output,input,count) (strlib->bin2hex((output),(input),(count))) #endif /* STRLIB_C */ -#endif /* _STRLIB_H_ */ + +#endif /* _COMMON_STRLIB_H_ */ |