diff options
author | Haru <haru@dotalux.com> | 2014-07-10 16:59:55 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2014-07-11 08:47:27 +0200 |
commit | 68e7f53f05dd80e8b4ab9d84c9931df22a6b060c (patch) | |
tree | 5b3d0f0b2f7aad19735b16c8a443a9534d0f5224 /src/common | |
parent | 8b4f35532c8fd7c7f0939756923fdaf14ee39531 (diff) | |
download | hercules-68e7f53f05dd80e8b4ab9d84c9931df22a6b060c.tar.gz hercules-68e7f53f05dd80e8b4ab9d84c9931df22a6b060c.tar.bz2 hercules-68e7f53f05dd80e8b4ab9d84c9931df22a6b060c.tar.xz hercules-68e7f53f05dd80e8b4ab9d84c9931df22a6b060c.zip |
Fixed reserved __identifier violations
- Complies with CERT DCL37-C
- Fixes issue #293 (special thanks to elfring)
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common')
35 files changed, 211 insertions, 216 deletions
diff --git a/src/common/HPM.h b/src/common/HPM.h index 5667f605a..fe8d45066 100644 --- a/src/common/HPM.h +++ b/src/common/HPM.h @@ -1,8 +1,8 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file -#ifndef _COMMON_HPM_H_ -#define _COMMON_HPM_H_ +#ifndef COMMON_HPM_H +#define COMMON_HPM_H #ifndef HERCULES_CORE #error You should never include HPM.h from a plugin. @@ -158,4 +158,4 @@ struct HPM_interface *HPM; void hpm_defaults(void); -#endif /* _COMMON_HPM_H_ */ +#endif /* COMMON_HPM_H */ diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index c5ec3771d..79ec36472 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -3,140 +3,140 @@ // // NOTE: This file was auto-generated and should never be manually edited, // as it will get overwritten. -#ifndef _HPM_DATA_CHECK_H_ -#define _HPM_DATA_CHECK_H_ +#ifndef HPM_DATA_CHECK_H +#define HPM_DATA_CHECK_H HPExport const struct s_HPMDataCheck HPMDataCheck[] = { - #ifdef _COMMON_CONF_H_ + #ifdef COMMON_CONF_H { "libconfig_interface", sizeof(struct libconfig_interface) }, #else - #define _COMMON_CONF_H_ - #endif // _COMMON_CONF_H_ - #ifdef _COMMON_DB_H_ + #define COMMON_CONF_H + #endif // COMMON_CONF_H + #ifdef COMMON_DB_H { "DBData", sizeof(struct DBData) }, { "DBIterator", sizeof(struct DBIterator) }, { "DBMap", sizeof(struct DBMap) }, #else - #define _COMMON_DB_H_ - #endif // _COMMON_DB_H_ - #ifdef _COMMON_DES_H_ + #define COMMON_DB_H + #endif // COMMON_DB_H + #ifdef COMMON_DES_H { "BIT64", sizeof(struct BIT64) }, #else - #define _COMMON_DES_H_ - #endif // _COMMON_DES_H_ - #ifdef _COMMON_ERS_H_ + #define COMMON_DES_H + #endif // COMMON_DES_H + #ifdef COMMON_ERS_H { "eri", sizeof(struct eri) }, #else - #define _COMMON_ERS_H_ - #endif // _COMMON_ERS_H_ - #ifdef _COMMON_MAPINDEX_H_ + #define COMMON_ERS_H + #endif // COMMON_ERS_H + #ifdef COMMON_MAPINDEX_H { "mapindex_interface", sizeof(struct mapindex_interface) }, #else - #define _COMMON_MAPINDEX_H_ - #endif // _COMMON_MAPINDEX_H_ - #ifdef _COMMON_MMO_H_ + #define COMMON_MAPINDEX_H + #endif // COMMON_MAPINDEX_H + #ifdef COMMON_MMO_H { "quest", sizeof(struct quest) }, #else - #define _COMMON_MMO_H_ - #endif // _COMMON_MMO_H_ - #ifdef _COMMON_SOCKET_H_ + #define COMMON_MMO_H + #endif // COMMON_MMO_H + #ifdef COMMON_SOCKET_H { "socket_interface", sizeof(struct socket_interface) }, #else - #define _COMMON_SOCKET_H_ - #endif // _COMMON_SOCKET_H_ - #ifdef _COMMON_STRLIB_H_ + #define COMMON_SOCKET_H + #endif // COMMON_SOCKET_H + #ifdef COMMON_STRLIB_H { "StringBuf", sizeof(struct StringBuf) }, { "s_svstate", sizeof(struct s_svstate) }, #else - #define _COMMON_STRLIB_H_ - #endif // _COMMON_STRLIB_H_ - #ifdef _COMMON_SYSINFO_H_ + #define COMMON_STRLIB_H + #endif // COMMON_STRLIB_H + #ifdef COMMON_SYSINFO_H { "sysinfo_interface", sizeof(struct sysinfo_interface) }, #else - #define _COMMON_SYSINFO_H_ - #endif // _COMMON_SYSINFO_H_ - #ifdef _MAP_ATCOMMAND_H_ + #define COMMON_SYSINFO_H + #endif // COMMON_SYSINFO_H + #ifdef MAP_ATCOMMAND_H { "AliasInfo", sizeof(struct AliasInfo) }, { "atcommand_interface", sizeof(struct atcommand_interface) }, #else - #define _MAP_ATCOMMAND_H_ - #endif // _MAP_ATCOMMAND_H_ - #ifdef _MAP_BATTLE_H_ + #define MAP_ATCOMMAND_H + #endif // MAP_ATCOMMAND_H + #ifdef MAP_BATTLE_H { "Damage", sizeof(struct Damage) }, { "battle_interface", sizeof(struct battle_interface) }, #else - #define _MAP_BATTLE_H_ - #endif // _MAP_BATTLE_H_ - #ifdef _MAP_BUYINGSTORE_H_ + #define MAP_BATTLE_H + #endif // MAP_BATTLE_H + #ifdef MAP_BUYINGSTORE_H { "buyingstore_interface", sizeof(struct buyingstore_interface) }, { "s_buyingstore_item", sizeof(struct s_buyingstore_item) }, #else - #define _MAP_BUYINGSTORE_H_ - #endif // _MAP_BUYINGSTORE_H_ - #ifdef _MAP_CHRIF_H_ + #define MAP_BUYINGSTORE_H + #endif // MAP_BUYINGSTORE_H + #ifdef MAP_CHRIF_H { "auth_node", sizeof(struct auth_node) }, #else - #define _MAP_CHRIF_H_ - #endif // _MAP_CHRIF_H_ - #ifdef _MAP_CLIF_H_ + #define MAP_CHRIF_H + #endif // MAP_CHRIF_H + #ifdef MAP_CLIF_H { "clif_interface", sizeof(struct clif_interface) }, #else - #define _MAP_CLIF_H_ - #endif // _MAP_CLIF_H_ - #ifdef _MAP_ELEMENTAL_H_ + #define MAP_CLIF_H + #endif // MAP_CLIF_H + #ifdef MAP_ELEMENTAL_H { "elemental_skill", sizeof(struct elemental_skill) }, #else - #define _MAP_ELEMENTAL_H_ - #endif // _MAP_ELEMENTAL_H_ - #ifdef _MAP_GUILD_H_ + #define MAP_ELEMENTAL_H + #endif // MAP_ELEMENTAL_H + #ifdef MAP_GUILD_H { "eventlist", sizeof(struct eventlist) }, { "guardian_data", sizeof(struct guardian_data) }, #else - #define _MAP_GUILD_H_ - #endif // _MAP_GUILD_H_ - #ifdef _MAP_MAPREG_H_ + #define MAP_GUILD_H + #endif // MAP_GUILD_H + #ifdef MAP_MAPREG_H { "mapreg_save", sizeof(struct mapreg_save) }, #else - #define _MAP_MAPREG_H_ - #endif // _MAP_MAPREG_H_ - #ifdef _MAP_MAP_H_ + #define MAP_MAPREG_H + #endif // MAP_MAPREG_H + #ifdef MAP_MAP_H { "map_data_other_server", sizeof(struct map_data_other_server) }, #else - #define _MAP_MAP_H_ - #endif // _MAP_MAP_H_ - #ifdef _MAP_PACKETS_STRUCT_H_ + #define MAP_MAP_H + #endif // MAP_MAP_H + #ifdef MAP_PACKETS_STRUCT_H { "EQUIPSLOTINFO", sizeof(struct EQUIPSLOTINFO) }, #else - #define _MAP_PACKETS_STRUCT_H_ - #endif // _MAP_PACKETS_STRUCT_H_ - #ifdef _MAP_PC_H_ + #define MAP_PACKETS_STRUCT_H + #endif // MAP_PACKETS_STRUCT_H + #ifdef MAP_PC_H { "autotrade_vending", sizeof(struct autotrade_vending) }, { "item_cd", sizeof(struct item_cd) }, #else - #define _MAP_PC_H_ - #endif // _MAP_PC_H_ - #ifdef _MAP_SCRIPT_H_ + #define MAP_PC_H + #endif // MAP_PC_H + #ifdef MAP_SCRIPT_H { "Script_Config", sizeof(struct Script_Config) }, { "reg_db", sizeof(struct reg_db) }, { "script_interface", sizeof(struct script_interface) }, #else - #define _MAP_SCRIPT_H_ - #endif // _MAP_SCRIPT_H_ - #ifdef _MAP_SEARCHSTORE_H_ + #define MAP_SCRIPT_H + #endif // MAP_SCRIPT_H + #ifdef MAP_SEARCHSTORE_H { "searchstore_interface", sizeof(struct searchstore_interface) }, #else - #define _MAP_SEARCHSTORE_H_ - #endif // _MAP_SEARCHSTORE_H_ - #ifdef _MAP_SKILL_H_ + #define MAP_SEARCHSTORE_H + #endif // MAP_SEARCHSTORE_H + #ifdef MAP_SKILL_H { "skill_cd", sizeof(struct skill_cd) }, { "skill_condition", sizeof(struct skill_condition) }, { "skill_interface", sizeof(struct skill_interface) }, { "skill_unit_save", sizeof(struct skill_unit_save) }, #else - #define _MAP_SKILL_H_ - #endif // _MAP_SKILL_H_ + #define MAP_SKILL_H + #endif // MAP_SKILL_H }; HPExport unsigned int HPMDataCheckLen = ARRAYLENGTH(HPMDataCheck); -#endif /* _HPM_DATA_CHECK_H_ */ +#endif /* HPM_DATA_CHECK_H */ diff --git a/src/common/HPMi.h b/src/common/HPMi.h index b98e87d90..478cfbdd9 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -1,8 +1,8 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file -#ifndef _COMMON_HPMI_H_ -#define _COMMON_HPMI_H_ +#ifndef COMMON_HPMI_H +#define COMMON_HPMI_H #include "../common/cbasetypes.h" #include "../common/console.h" @@ -184,4 +184,4 @@ HPExport struct HPMi_interface { HPExport struct HPMi_interface *HPMi; #endif -#endif /* _COMMON_HPMI_H_ */ +#endif /* COMMON_HPMI_H */ diff --git a/src/common/atomic.h b/src/common/atomic.h index 526811a09..e73b1c464 100644 --- a/src/common/atomic.h +++ b/src/common/atomic.h @@ -1,8 +1,8 @@ // Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _COMMON_ATOMIC_H_ -#define _COMMON_ATOMIC_H_ +#ifndef COMMON_ATOMIC_H +#define COMMON_ATOMIC_H // Atomic Operations // (Interlocked CompareExchange, Add .. and so on ..) @@ -146,4 +146,4 @@ static forceinline int32 InterlockedExchange(volatile int32 *target, int32 val){ #endif //endif compiler decision -#endif /* _COMMON_ATOMIC_H_ */ +#endif /* COMMON_ATOMIC_H */ diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index ac65b08a8..42075de8e 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -1,5 +1,5 @@ -#ifndef _COMMON_CBASETYPES_H_ -#define _COMMON_CBASETYPES_H_ +#ifndef COMMON_CBASETYPES_H +#define COMMON_CBASETYPES_H /* +--------+-----------+--------+---------+ * | ILP32 | LP64 | ILP64 | (LL)P64 | @@ -444,9 +444,9 @@ void SET_FUNCPOINTER(T1& var, T2 p) /* pointer size fix which fixes several gcc warnings */ #ifdef __64BIT__ - #define __64BPTRSIZE(y) ((intptr)(y)) + #define h64BPTRSIZE(y) ((intptr)(y)) #else - #define __64BPTRSIZE(y) (y) + #define h64BPTRSIZE(y) (y) #endif -#endif /* _COMMON_CBASETYPES_H_ */ +#endif /* COMMON_CBASETYPES_H */ diff --git a/src/common/conf.h b/src/common/conf.h index 7c275bec2..c232a035c 100644 --- a/src/common/conf.h +++ b/src/common/conf.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _COMMON_CONF_H_ -#define _COMMON_CONF_H_ +#ifndef COMMON_CONF_H +#define COMMON_CONF_H #include "../common/cbasetypes.h" @@ -95,4 +95,4 @@ struct libconfig_interface *libconfig; void libconfig_defaults(void); -#endif // _COMMON_CONF_H_ +#endif // COMMON_CONF_H diff --git a/src/common/console.h b/src/common/console.h index 55a9a767c..062d48bbe 100644 --- a/src/common/console.h +++ b/src/common/console.h @@ -1,8 +1,8 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file -#ifndef _COMMON_CONSOLE_H_ -#define _COMMON_CONSOLE_H_ +#ifndef COMMON_CONSOLE_H +#define COMMON_CONSOLE_H #include "../config/core.h" // MAX_CONSOLE_INPUT @@ -93,4 +93,4 @@ struct console_interface *console; void console_defaults(void); -#endif /* _COMMON_CONSOLE_H_ */ +#endif /* COMMON_CONSOLE_H */ diff --git a/src/common/core.h b/src/common/core.h index ba75e6b01..a8337e1b9 100644 --- a/src/common/core.h +++ b/src/common/core.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _COMMON_CORE_H_ -#define _COMMON_CORE_H_ +#ifndef COMMON_CORE_H +#define COMMON_CORE_H #include "../common/db.h" #include "../common/mmo.h" @@ -47,4 +47,4 @@ enum E_CORE_ST { /// If NULL, runflag is set to CORE_ST_STOP instead. extern void (*shutdown_callback)(void); -#endif /* _COMMON_CORE_H_ */ +#endif /* COMMON_CORE_H */ diff --git a/src/common/db.h b/src/common/db.h index 4f8d6be79..ed87e474b 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -39,8 +39,8 @@ * @encoding US-ASCII * * @see common#db.c * \*****************************************************************************/ -#ifndef _COMMON_DB_H_ -#define _COMMON_DB_H_ +#ifndef COMMON_DB_H +#define COMMON_DB_H #include <stdarg.h> @@ -1549,4 +1549,4 @@ void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); -#endif /* _COMMON_DB_H_ */ +#endif /* COMMON_DB_H */ diff --git a/src/common/des.h b/src/common/des.h index 0f908a15b..2c7190f23 100644 --- a/src/common/des.h +++ b/src/common/des.h @@ -1,7 +1,7 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _COMMON_DES_H_ -#define _COMMON_DES_H_ +#ifndef COMMON_DES_H +#define COMMON_DES_H #include "../common/cbasetypes.h" @@ -13,4 +13,4 @@ void des_decrypt_block(BIT64* block); void des_decrypt(unsigned char* data, size_t size); -#endif // _COMMON_DES_H_ +#endif // COMMON_DES_H diff --git a/src/common/ers.h b/src/common/ers.h index e11f7f37e..904f7fb81 100644 --- a/src/common/ers.h +++ b/src/common/ers.h @@ -37,8 +37,8 @@ * @author Flavio @ Amazon Project * * @encoding US-ASCII * \*****************************************************************************/ -#ifndef _COMMON_ERS_H_ -#define _COMMON_ERS_H_ +#ifndef COMMON_ERS_H +#define COMMON_ERS_H #include "../common/cbasetypes.h" @@ -175,4 +175,4 @@ void ers_report(void); void ers_final(void); #endif /* DISABLE_ERS / not DISABLE_ERS */ -#endif /* _COMMON_ERS_H_ */ +#endif /* COMMON_ERS_H */ diff --git a/src/common/grfio.c b/src/common/grfio.c index f592812f6..6e628a512 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -23,7 +23,7 @@ //---------------------------- // file entry table struct //---------------------------- -typedef struct _FILELIST { +typedef struct FILELIST { int srclen; ///< compressed size int srclen_aligned; int declen; ///< original size diff --git a/src/common/grfio.h b/src/common/grfio.h index 930ed7e36..15659c17c 100644 --- a/src/common/grfio.h +++ b/src/common/grfio.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _COMMON_GRFIO_H_ -#define _COMMON_GRFIO_H_ +#ifndef COMMON_GRFIO_H +#define COMMON_GRFIO_H void grfio_init(const char* fname); void grfio_final(void); @@ -14,4 +14,4 @@ unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); -#endif /* _COMMON_GRFIO_H_ */ +#endif /* COMMON_GRFIO_H */ diff --git a/src/common/malloc.c b/src/common/malloc.c index fbe8e2d9d..3c9fa9c54 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -235,14 +235,13 @@ static size_t hash2size( unsigned short hash ) } } -void* _mmalloc(size_t size, const char *file, int line, const char *func ) -{ +void *mmalloc_(size_t size, const char *file, int line, const char *func) { struct block *block; short size_hash = size2hash( size ); struct unit_head *head; if (((long) size) < 0) { - ShowError("_mmalloc: %d\n", size); + ShowError("mmalloc_: %d\n", size); return NULL; } @@ -341,15 +340,13 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) return (char *)head + sizeof(struct unit_head) - sizeof(long); } -void* _mcalloc(size_t num, size_t size, const char *file, int line, const char *func ) -{ +void *mcalloc_(size_t num, size_t size, const char *file, int line, const char *func) { void *p = iMalloc->malloc(num * size,file,line,func); memset(p,0,num * size); return p; } -void* _mrealloc(void *memblock, size_t size, const char *file, int line, const char *func ) -{ +void *mrealloc_(void *memblock, size_t size, const char *file, int line, const char *func) { size_t old_size; if(memblock == NULL) { return iMalloc->malloc(size,file,line,func); @@ -373,8 +370,8 @@ void* _mrealloc(void *memblock, size_t size, const char *file, int line, const c } } -/* a _mrealloc clone with the difference it 'z'eroes the newly created memory */ -void* _mreallocz(void *memblock, size_t size, const char *file, int line, const char *func ) { +/* a mrealloc_ clone with the difference it 'z'eroes the newly created memory */ +void *mreallocz_(void *memblock, size_t size, const char *file, int line, const char *func) { size_t old_size; void *p = NULL; @@ -404,8 +401,7 @@ void* _mreallocz(void *memblock, size_t size, const char *file, int line, const } -char* _mstrdup(const char *p, const char *file, int line, const char *func ) -{ +char *mstrdup_(const char *p, const char *file, int line, const char *func) { if(p == NULL) { return NULL; } else { @@ -416,8 +412,7 @@ char* _mstrdup(const char *p, const char *file, int line, const char *func ) } } -void _mfree(void *ptr, const char *file, int line, const char *func ) -{ +void mfree_(void *ptr, const char *file, int line, const char *func) { struct unit_head *head; if (ptr == NULL) @@ -852,12 +847,12 @@ void malloc_defaults(void) { // Athena's built-in Memory Manager #ifdef USE_MEMMGR - iMalloc->malloc = _mmalloc; - iMalloc->calloc = _mcalloc; - iMalloc->realloc = _mrealloc; - iMalloc->reallocz= _mreallocz; - iMalloc->astrdup = _mstrdup; - iMalloc->free = _mfree; + iMalloc->malloc = mmalloc_; + iMalloc->calloc = mcalloc_; + iMalloc->realloc = mrealloc_; + iMalloc->reallocz= mreallocz_; + iMalloc->astrdup = mstrdup_; + iMalloc->free = mfree_; #else iMalloc->malloc = aMalloc_; iMalloc->calloc = aCalloc_; diff --git a/src/common/malloc.h b/src/common/malloc.h index 7309bb0f7..8dace2d68 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _COMMON_MALLOC_H_ -#define _COMMON_MALLOC_H_ +#ifndef COMMON_MALLOC_H +#define COMMON_MALLOC_H #include "../common/cbasetypes.h" @@ -88,4 +88,4 @@ struct malloc_interface { void memmgr_report (int extra); struct malloc_interface *iMalloc; -#endif /* _COMMON_MALLOC_H_ */ +#endif /* COMMON_MALLOC_H */ diff --git a/src/common/mapindex.h b/src/common/mapindex.h index fa9b9e920..446a2422d 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _COMMON_MAPINDEX_H_ -#define _COMMON_MAPINDEX_H_ +#ifndef COMMON_MAPINDEX_H +#define COMMON_MAPINDEX_H #include "../common/db.h" #include "../common/mmo.h" @@ -90,4 +90,4 @@ struct mapindex_interface *mapindex; void mapindex_defaults(void); -#endif /* _COMMON_MAPINDEX_H_ */ +#endif /* COMMON_MAPINDEX_H */ diff --git a/src/common/md5calc.h b/src/common/md5calc.h index d0caf6787..740e2edcc 100644 --- a/src/common/md5calc.h +++ b/src/common/md5calc.h @@ -1,8 +1,8 @@ -#ifndef _COMMON_MD5CALC_H_ -#define _COMMON_MD5CALC_H_ +#ifndef COMMON_MD5CALC_H +#define COMMON_MD5CALC_H void MD5_String(const char * string, char * output); void MD5_Binary(const char * string, unsigned char * output); void MD5_Salt(unsigned int len, char * output); -#endif /* _COMMON_MD5CALC_H_ */ +#endif /* COMMON_MD5CALC_H */ diff --git a/src/common/mmo.h b/src/common/mmo.h index 8e57eee85..feeb06524 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _COMMON_MMO_H_ -#define _COMMON_MMO_H_ +#ifndef COMMON_MMO_H +#define COMMON_MMO_H #include <time.h> @@ -932,4 +932,4 @@ enum e_pc_reg_loading { #error MAX_ZENY is too big #endif -#endif /* _COMMON_MMO_H_ */ +#endif /* COMMON_MMO_H */ diff --git a/src/common/mutex.h b/src/common/mutex.h index ced91ab8e..d298c05af 100644 --- a/src/common/mutex.h +++ b/src/common/mutex.h @@ -1,8 +1,8 @@ // Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _COMMON_MUTEX_H_ -#define _COMMON_MUTEX_H_ +#ifndef COMMON_MUTEX_H +#define COMMON_MUTEX_H #include "../common/cbasetypes.h" @@ -90,4 +90,4 @@ void racond_signal(racond *c); void racond_broadcast(racond *c); -#endif /* _COMMON_MUTEX_H_ */ +#endif /* COMMON_MUTEX_H */ diff --git a/src/common/nullpo.h b/src/common/nullpo.h index fb1cf0feb..581252cca 100644 --- a/src/common/nullpo.h +++ b/src/common/nullpo.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _COMMON_NULLPO_H_ -#define _COMMON_NULLPO_H_ +#ifndef COMMON_NULLPO_H +#define COMMON_NULLPO_H #include "../common/cbasetypes.h" @@ -125,4 +125,4 @@ void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title); -#endif /* _COMMON_NULLPO_H_ */ +#endif /* COMMON_NULLPO_H */ diff --git a/src/common/random.h b/src/common/random.h index ab83fb4d4..15d7f8ab1 100644 --- a/src/common/random.h +++ b/src/common/random.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _COMMON_RANDOM_H_ -#define _COMMON_RANDOM_H_ +#ifndef COMMON_RANDOM_H +#define COMMON_RANDOM_H #include "../common/cbasetypes.h" @@ -15,4 +15,4 @@ int32 rnd_value(int32 min, int32 max);// [min, max] double rnd_uniform(void);// [0.0, 1.0) double rnd_uniform53(void);// [0.0, 1.0) -#endif /* _COMMON_RANDOM_H_ */ +#endif /* COMMON_RANDOM_H */ diff --git a/src/common/showmsg.c b/src/common/showmsg.c index ece10c1a8..b9bcef9b2 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -654,7 +654,7 @@ int FPRINTF(FILE *file, const char *fmt, ...) char timestamp_format[20] = ""; //For displaying Timestamps -int _vShowMessage(enum msg_type flag, const char *string, va_list ap) +int vShowMessage_(enum msg_type flag, const char *string, va_list ap) { va_list apcopy; char prefix[100]; @@ -663,7 +663,7 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap) #endif if (!string || *string == '\0') { - ShowError("Empty string passed to _vShowMessage().\n"); + ShowError("Empty string passed to vShowMessage_().\n"); return 1; } if( @@ -734,7 +734,7 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap) strcat(prefix,CL_RED"[Fatal Error]"CL_RESET":"); break; default: - ShowError("In function _vShowMessage() -> Invalid flag passed.\n"); + ShowError("In function vShowMessage_() -> Invalid flag passed.\n"); return 1; } @@ -782,12 +782,12 @@ void ClearScreen(void) ShowMessage(CL_CLS); // to prevent empty string passed messages #endif } -int _ShowMessage(enum msg_type flag, const char *string, ...) +int ShowMessage_(enum msg_type flag, const char *string, ...) { int ret; va_list ap; va_start(ap, string); - ret = _vShowMessage(flag, string, ap); + ret = vShowMessage_(flag, string, ap); va_end(ap); return ret; } @@ -796,37 +796,37 @@ int _ShowMessage(enum msg_type flag, const char *string, ...) void ShowMessage(const char *string, ...) { va_list ap; va_start(ap, string); - _vShowMessage(MSG_NONE, string, ap); + vShowMessage_(MSG_NONE, string, ap); va_end(ap); } void ShowStatus(const char *string, ...) { va_list ap; va_start(ap, string); - _vShowMessage(MSG_STATUS, string, ap); + vShowMessage_(MSG_STATUS, string, ap); va_end(ap); } void ShowSQL(const char *string, ...) { va_list ap; va_start(ap, string); - _vShowMessage(MSG_SQL, string, ap); + vShowMessage_(MSG_SQL, string, ap); va_end(ap); } void ShowInfo(const char *string, ...) { va_list ap; va_start(ap, string); - _vShowMessage(MSG_INFORMATION, string, ap); + vShowMessage_(MSG_INFORMATION, string, ap); va_end(ap); } void ShowNotice(const char *string, ...) { va_list ap; va_start(ap, string); - _vShowMessage(MSG_NOTICE, string, ap); + vShowMessage_(MSG_NOTICE, string, ap); va_end(ap); } void ShowWarning(const char *string, ...) { va_list ap; va_start(ap, string); - _vShowMessage(MSG_WARNING, string, ap); + vShowMessage_(MSG_WARNING, string, ap); va_end(ap); } void ShowConfigWarning(config_setting_t *config, const char *string, ...) @@ -837,25 +837,25 @@ void ShowConfigWarning(config_setting_t *config, const char *string, ...) StrBuf->AppendStr(&buf, string); StrBuf->Printf(&buf, " (%s:%d)\n", config_setting_source_file(config), config_setting_source_line(config)); va_start(ap, string); - _vShowMessage(MSG_WARNING, StrBuf->Value(&buf), ap); + vShowMessage_(MSG_WARNING, StrBuf->Value(&buf), ap); va_end(ap); StrBuf->Destroy(&buf); } void ShowDebug(const char *string, ...) { va_list ap; va_start(ap, string); - _vShowMessage(MSG_DEBUG, string, ap); + vShowMessage_(MSG_DEBUG, string, ap); va_end(ap); } void ShowError(const char *string, ...) { va_list ap; va_start(ap, string); - _vShowMessage(MSG_ERROR, string, ap); + vShowMessage_(MSG_ERROR, string, ap); va_end(ap); } void ShowFatalError(const char *string, ...) { va_list ap; va_start(ap, string); - _vShowMessage(MSG_FATALERROR, string, ap); + vShowMessage_(MSG_FATALERROR, string, ap); va_end(ap); } diff --git a/src/common/showmsg.h b/src/common/showmsg.h index 8008acf5a..83eb0ad89 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _COMMON_SHOWMSG_H_ -#define _COMMON_SHOWMSG_H_ +#ifndef COMMON_SHOWMSG_H +#define COMMON_SHOWMSG_H #include <stdarg.h> @@ -115,6 +115,6 @@ extern void ClearScreen(void); HPExport void (*ShowFatalError) (const char *, ...); #endif -extern int _vShowMessage(enum msg_type flag, const char *string, va_list ap); +extern int vShowMessage_(enum msg_type flag, const char *string, va_list ap); -#endif /* _COMMON_SHOWMSG_H_ */ +#endif /* COMMON_SHOWMSG_H */ diff --git a/src/common/socket.c b/src/common/socket.c index 58c2d5bf9..85f0aa0ce 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -5,9 +5,9 @@ #define HERCULES_CORE #include "../config/core.h" // SHOW_SERVER_STATS -#define _H_SOCKET_C_ +#define H_SOCKET_C #include "socket.h" -#undef _H_SOCKET_C_ +#undef H_SOCKET_C #include <stdio.h> #include <stdlib.h> @@ -909,20 +909,20 @@ int do_sockets(int next) ////////////////////////////// // IP rules and DDoS protection -typedef struct _connect_history { - struct _connect_history* next; +typedef struct connect_history { + struct connect_history* next; uint32 ip; int64 tick; int count; unsigned ddos : 1; } ConnectHistory; -typedef struct _access_control { +typedef struct access_control { uint32 ip; uint32 mask; } AccessControl; -enum _aco { +enum aco { ACO_DENY_ALLOW, ACO_ALLOW_DENY, ACO_MUTUAL_FAILURE diff --git a/src/common/socket.h b/src/common/socket.h index 804b9284f..42b0efe3b 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _COMMON_SOCKET_H_ -#define _COMMON_SOCKET_H_ +#ifndef COMMON_SOCKET_H +#define COMMON_SOCKET_H #include <time.h> @@ -174,7 +174,7 @@ struct socket_interface *sockt; void socket_defaults(void); /* the purpose of these macros is simply to not make calling them be an annoyance */ -#ifndef _H_SOCKET_C_ +#ifndef H_SOCKET_C #define make_listen_bind(ip, port) ( sockt->make_listen_bind(ip, port) ) #define make_connection(ip, port, opt) ( sockt->make_connection(ip, port, opt) ) #define realloc_fifo(fd, rfifo_size, wfifo_size) ( sockt->realloc_fifo(fd, rfifo_size, wfifo_size) ) @@ -194,6 +194,6 @@ void socket_defaults(void); #define ntows(netshort) ( sockt->ntows(netshort) ) #define getips(ips, max) ( sockt->getips(ips, max) ) #define set_eof(fd) ( sockt->set_eof(fd) ) -#endif /* _H_SOCKET_C_ */ +#endif /* H_SOCKET_C */ -#endif /* _COMMON_SOCKET_H_ */ +#endif /* COMMON_SOCKET_H */ diff --git a/src/common/spinlock.h b/src/common/spinlock.h index 5d57c6462..bde36b8e5 100644 --- a/src/common/spinlock.h +++ b/src/common/spinlock.h @@ -1,5 +1,5 @@ -#ifndef _COMMON_SPINLOCK_H_ -#define _COMMON_SPINLOCK_H_ +#ifndef COMMON_SPINLOCK_H +#define COMMON_SPINLOCK_H // // CAS based Spinlock Implementation @@ -100,4 +100,4 @@ static forceinline void LeaveSpinLock(SPIN_LOCK *lck){ -#endif /* _COMMON_SPINLOCK_H_ */ +#endif /* COMMON_SPINLOCK_H */ diff --git a/src/common/sql.h b/src/common/sql.h index 3bdb76c74..f9593978c 100644 --- a/src/common/sql.h +++ b/src/common/sql.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _COMMON_SQL_H_ -#define _COMMON_SQL_H_ +#ifndef COMMON_SQL_H +#define COMMON_SQL_H #include <stdarg.h>// va_list @@ -291,4 +291,4 @@ void Sql_HerculesUpdateSkip(Sql* self,const char *filename); void Sql_Init(void); -#endif /* _COMMON_SQL_H_ */ +#endif /* COMMON_SQL_H */ diff --git a/src/common/strlib.c b/src/common/strlib.c index 2ce8fd347..e2382e6fc 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -4,9 +4,9 @@ #define HERCULES_CORE -#define _H_STRLIB_C_ +#define H_STRLIB_C #include "strlib.h" -#undef _H_STRLIB_C_ +#undef H_STRLIB_C #include <errno.h> #include <stdio.h> @@ -224,7 +224,7 @@ const char* stristr(const char* haystack, const char* needle) } #ifdef __WIN32 -char* _strtok_r(char *s1, const char *s2, char **lasts) { +char* strtok_r_(char *s1, const char *s2, char **lasts) { char *ret; if (s1 == NULL) diff --git a/src/common/strlib.h b/src/common/strlib.h index f39f27789..7f84d2893 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 _COMMON_STRLIB_H_ -#define _COMMON_STRLIB_H_ +#ifndef COMMON_STRLIB_H +#define COMMON_STRLIB_H #include <stdarg.h> #include <string.h> @@ -12,8 +12,8 @@ #ifdef WIN32 #define HAVE_STRTOK_R - #define strtok_r(s,delim,save_ptr) _strtok_r((s),(delim),(save_ptr)) - char *_strtok_r(char* s1, const char* s2, char** lasts); + #define strtok_r(s,delim,save_ptr) strtok_r_((s),(delim),(save_ptr)) + char *strtok_r_(char* s1, const char* s2, char** lasts); #endif /// Bitfield determining the behavior of sv_parse and sv_split. @@ -159,7 +159,7 @@ struct sv_interface *sv; void strlib_defaults(void); /* the purpose of these macros is simply to not make calling them be an annoyance */ -#ifndef _H_STRLIB_C_ +#ifndef H_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))) @@ -183,6 +183,6 @@ void strlib_defaults(void); #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 /* _H_STRLIB_C_ */ +#endif /* H_STRLIB_C */ -#endif /* _COMMON_STRLIB_H_ */ +#endif /* COMMON_STRLIB_H */ diff --git a/src/common/sysinfo.h b/src/common/sysinfo.h index 24f794cb4..600206a21 100644 --- a/src/common/sysinfo.h +++ b/src/common/sysinfo.h @@ -2,8 +2,8 @@ // See the LICENSE file // Base Author: Haru @ http://hercules.ws -#ifndef _COMMON_SYSINFO_H_ -#define _COMMON_SYSINFO_H_ +#ifndef COMMON_SYSINFO_H +#define COMMON_SYSINFO_H /** * Provides various bits of information about the system Hercules is running on @@ -48,4 +48,4 @@ struct sysinfo_interface *sysinfo; void sysinfo_defaults(void); -#endif /* _COMMON_SYSINFO_H_ */ +#endif /* COMMON_SYSINFO_H */ diff --git a/src/common/thread.c b/src/common/thread.c index d8e0dbf0a..d680d0347 100644 --- a/src/common/thread.c +++ b/src/common/thread.c @@ -106,9 +106,9 @@ static void rat_thread_terminated(rAthread *handle) { }//end: rat_thread_terminated() #ifdef WIN32 -DWORD WINAPI _raThreadMainRedirector(LPVOID p){ +DWORD WINAPI raThreadMainRedirector(LPVOID p){ #else -static void *_raThreadMainRedirector( void *p ){ +static void *raThreadMainRedirector( void *p ){ sigset_t set; // on Posix Thread platforms #endif void *ret; @@ -145,7 +145,7 @@ static void *_raThreadMainRedirector( void *p ){ #else return ret; #endif -}//end: _raThreadMainRedirector() +}//end: raThreadMainRedirector() @@ -193,12 +193,12 @@ rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack handle->param = param; #ifdef WIN32 - handle->hThread = CreateThread(NULL, szStack, _raThreadMainRedirector, (void*)handle, 0, NULL); + handle->hThread = CreateThread(NULL, szStack, raThreadMainRedirector, (void*)handle, 0, NULL); #else pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, szStack); - if(pthread_create(&handle->hThread, &attr, _raThreadMainRedirector, (void*)handle) != 0){ + if(pthread_create(&handle->hThread, &attr, raThreadMainRedirector, (void*)handle) != 0){ handle->proc = NULL; handle->param = NULL; return NULL; diff --git a/src/common/thread.h b/src/common/thread.h index 3b5ce7476..f781cfbd0 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -1,8 +1,8 @@ // Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _COMMON_THREAD_H_ -#define _COMMON_THREAD_H_ +#ifndef COMMON_THREAD_H +#define COMMON_THREAD_H #include "../common/cbasetypes.h" @@ -115,4 +115,4 @@ void rathread_init(); void rathread_final(); -#endif /* _COMMON_THREAD_H_ */ +#endif /* COMMON_THREAD_H */ diff --git a/src/common/timer.c b/src/common/timer.c index ab0471d51..128fc4daf 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -107,7 +107,7 @@ char* search_timer_func_list(TimerFunc func) #if defined(ENABLE_RDTSC) static uint64 RDTSC_BEGINTICK = 0, RDTSC_CLOCK = 0; -static __inline uint64 _rdtsc(){ +static __inline uint64 rdtsc_() { register union{ uint64 qw; uint32 dw[2]; @@ -127,14 +127,14 @@ static void rdtsc_calibrate(){ RDTSC_CLOCK = 0; for(i = 0; i < 5; i++){ - t1 = _rdtsc(); + t1 = rdtsc_(); usleep(1000000); //1000 MS - t2 = _rdtsc(); + t2 = rdtsc_(); RDTSC_CLOCK += (t2 - t1) / 1000; } RDTSC_CLOCK /= 5; - RDTSC_BEGINTICK = _rdtsc(); + RDTSC_BEGINTICK = rdtsc_(); ShowMessage(" done. (Frequency: %u Mhz)\n", (uint32)(RDTSC_CLOCK/1000) ); } @@ -175,7 +175,7 @@ static int64 sys_tick(void) { #elif defined(ENABLE_RDTSC) // RDTSC: Returns the number of CPU cycles since reset. Unreliable if // the CPU frequency is variable. - return (int64)((_rdtsc() - RDTSC_BEGINTICK) / RDTSC_CLOCK); + return (int64)((rdtsc_() - RDTSC_BEGINTICK) / RDTSC_CLOCK); #elif defined(HAVE_MONOTONIC_CLOCK) // Monotonic clock: Implementation-defined. // Clock that cannot be set and represents monotonic time since some diff --git a/src/common/timer.h b/src/common/timer.h index a07f81612..d0927adde 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _COMMON_TIMER_H_ -#define _COMMON_TIMER_H_ +#ifndef COMMON_TIMER_H +#define COMMON_TIMER_H #include "../common/cbasetypes.h" @@ -67,4 +67,4 @@ struct timer_interface *timer; void timer_defaults(void); -#endif /* _COMMON_TIMER_H_ */ +#endif /* COMMON_TIMER_H */ diff --git a/src/common/utils.h b/src/common/utils.h index 823651163..421698d95 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _COMMON_UTILS_H_ -#define _COMMON_UTILS_H_ +#ifndef COMMON_UTILS_H +#define COMMON_UTILS_H #include <stdio.h> // FILE* #include <time.h> @@ -65,4 +65,4 @@ struct HCache_interface *HCache; void HCache_defaults(void); -#endif /* _COMMON_UTILS_H_ */ +#endif /* COMMON_UTILS_H */ |