summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/atomic.h14
-rw-r--r--src/common/core.c6
-rw-r--r--src/common/db.h111
-rw-r--r--src/common/grfio.c24
-rw-r--r--src/common/mmo.h4
-rw-r--r--src/common/mutex.c17
-rw-r--r--src/common/nullpo.c1
-rw-r--r--src/common/socket.c14
-rw-r--r--src/common/sql.c88
-rw-r--r--src/common/sql.h25
-rw-r--r--src/common/strlib.c5
-rw-r--r--src/common/thread.c20
-rw-r--r--src/common/utils.c6
13 files changed, 10 insertions, 325 deletions
diff --git a/src/common/atomic.h b/src/common/atomic.h
index c1ea2aa48..1bb859b29 100644
--- a/src/common/atomic.h
+++ b/src/common/atomic.h
@@ -40,7 +40,6 @@ forceinline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch,
}
}
-
forceinline volatile int64 InterlockedIncrement64(volatile int64 *addend){
__int64 old;
do{
@@ -50,8 +49,6 @@ forceinline volatile int64 InterlockedIncrement64(volatile int64 *addend){
return (old + 1);
}
-
-
forceinline volatile int64 InterlockedDecrement64(volatile int64 *addend){
__int64 old;
@@ -97,53 +94,42 @@ static forceinline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64
return __sync_fetch_and_add(addend, increment);
}//end: InterlockedExchangeAdd64()
-
static forceinline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){
return __sync_fetch_and_add(addend, increment);
}//end: InterlockedExchangeAdd()
-
static forceinline int64 InterlockedIncrement64(volatile int64 *addend){
return __sync_add_and_fetch(addend, 1);
}//end: InterlockedIncrement64()
-
static forceinline int32 InterlockedIncrement(volatile int32 *addend){
return __sync_add_and_fetch(addend, 1);
}//end: InterlockedIncrement()
-
static forceinline int64 InterlockedDecrement64(volatile int64 *addend){
return __sync_sub_and_fetch(addend, 1);
}//end: InterlockedDecrement64()
-
static forceinline int32 InterlockedDecrement(volatile int32 *addend){
return __sync_sub_and_fetch(addend, 1);
}//end: InterlockedDecrement()
-
static forceinline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){
return __sync_val_compare_and_swap(dest, cmp, exch);
}//end: InterlockedCompareExchange64()
-
static forceinline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){
return __sync_val_compare_and_swap(dest, cmp, exch);
}//end: InterlockedCompareExchnage()
-
static forceinline int64 InterlockedExchange64(volatile int64 *target, int64 val){
return __sync_lock_test_and_set(target, val);
}//end: InterlockedExchange64()
-
static forceinline int32 InterlockedExchange(volatile int32 *target, int32 val){
return __sync_lock_test_and_set(target, val);
}//end: InterlockedExchange()
-
#endif //endif compiler decision
-
#endif /* COMMON_ATOMIC_H */
diff --git a/src/common/core.c b/src/common/core.c
index 7f5a1da53..dcc96fa41 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -206,7 +206,7 @@ const char *cmdline_arg_source(struct CmdlineArgData *arg) {
*/
bool cmdline_arg_add(unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options) {
struct CmdlineArgData *data = NULL;
-
+
RECREATE(cmdline->args_data, struct CmdlineArgData, ++cmdline->args_data_count);
data = &cmdline->args_data[cmdline->args_data_count-1];
data->pluginID = pluginID;
@@ -227,7 +227,7 @@ static CMDLINEARG(help)
ShowInfo("Usage: %s [options]\n", SERVER_NAME);
ShowInfo("\n");
ShowInfo("Options:\n");
-
+
for (i = 0; i < cmdline->args_data_count; i++) {
struct CmdlineArgData *data = &cmdline->args_data[i];
char altname[16], paramnames[256];
@@ -400,7 +400,7 @@ int main (int argc, char **argv) {
cmdline->exec(argc, argv, CMDLINE_OPT_SILENT);
iMalloc->init_messages(); // Initialization messages (after buying us some time to suppress them if needed)
-
+
sysinfo->init();
if (!(showmsg->silent&0x1))
diff --git a/src/common/db.h b/src/common/db.h
index 9b9cba8f8..73d44a755 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -269,13 +269,9 @@ typedef uint64 (*DBHasher)(DBKey key, unsigned short maxlen);
*/
typedef void (*DBReleaser)(DBKey key, DBData data, DBRelease which);
-
-
typedef struct DBIterator DBIterator;
typedef struct DBMap DBMap;
-
-
/**
* Database iterator.
* Supports forward iteration, backward iteration and removing entries from the database.
@@ -621,7 +617,6 @@ struct DBMap {
#define i64db_get(db,k) ( DB->data2ptr((db)->get((db),DB->i642key(k))) )
#define ui64db_get(db,k) ( DB->data2ptr((db)->get((db),DB->ui642key(k))) )
-
// Get int-type data from DBMaps of various key types
#define db_iget(db,k) ( DB->data2i((db)->get((db),(k))) )
#define idb_iget(db,k) ( DB->data2i((db)->get((db),DB->i2key(k))) )
@@ -940,7 +935,6 @@ void db_defaults(void);
HPShared struct db_interface *DB;
-
/// Finds an entry in an array.
/// ex: ARR_FIND(0, size, i, list[i] == target);
///
@@ -955,8 +949,6 @@ HPShared struct db_interface *DB;
break; \
}while(0)
-
-
/// Moves an entry of the array.
/// Use ARR_MOVERIGHT/ARR_MOVELEFT if __from and __to are direct numbers.
/// ex: ARR_MOVE(i, 0, list, int);// move index i to index 0
@@ -980,8 +972,6 @@ HPShared struct db_interface *DB;
} \
}while(0)
-
-
/// Moves an entry of the array to the right.
/// ex: ARR_MOVERIGHT(1, 4, list, int);// move index 1 to index 4
///
@@ -997,8 +987,6 @@ HPShared struct db_interface *DB;
memmove((__arr)+(__to), &__backup__, sizeof(__type)); \
}while(0)
-
-
/// Moves an entry of the array to the left.
/// ex: ARR_MOVELEFT(3, 0, list, int);// move index 3 to index 0
///
@@ -1014,14 +1002,10 @@ HPShared struct db_interface *DB;
memmove((__arr)+(__to), &__backup__, sizeof(__type)); \
}while(0)
-
-
/////////////////////////////////////////////////////////////////////
// Vector library based on defines. (dynamic array)
// uses aMalloc, aRealloc, aFree
-
-
/// Declares an anonymous vector struct.
///
/// @param __type Type of data
@@ -1032,8 +1016,6 @@ HPShared struct db_interface *DB;
__type* _data_; \
}
-
-
/// Declares a named vector struct.
///
/// @param __name Structure name
@@ -1045,8 +1027,6 @@ HPShared struct db_interface *DB;
__type* _data_; \
}
-
-
/// Declares and initializes an anonymous vector variable.
///
/// @param __type Type of data
@@ -1054,8 +1034,6 @@ HPShared struct db_interface *DB;
#define VECTOR_VAR(__type,__var) \
VECTOR_DECL(__type) __var = {0,0,NULL}
-
-
/// Declares and initializes a named vector variable.
///
/// @param __name Structure name
@@ -1063,16 +1041,12 @@ HPShared struct db_interface *DB;
#define VECTOR_STRUCT_VAR(__name,__var) \
struct __name __var = {0,0,NULL}
-
-
/// Initializes a vector.
///
/// @param __vec Vector
#define VECTOR_INIT(__vec) \
memset(&(__vec), 0, sizeof(__vec))
-
-
/// Returns the internal array of values.
///
/// @param __vec Vector
@@ -1080,8 +1054,6 @@ HPShared struct db_interface *DB;
#define VECTOR_DATA(__vec) \
( (__vec)._data_ )
-
-
/// Returns the length of the vector.
///
/// @param __vec Vector
@@ -1089,8 +1061,6 @@ HPShared struct db_interface *DB;
#define VECTOR_LENGTH(__vec) \
( (__vec)._len_ )
-
-
/// Returns the capacity of the vector.
///
/// @param __vec Vector
@@ -1098,8 +1068,6 @@ HPShared struct db_interface *DB;
#define VECTOR_CAPACITY(__vec) \
( (__vec)._max_ )
-
-
/// Returns the value at the target index.
/// Assumes the index exists.
///
@@ -1109,8 +1077,6 @@ HPShared struct db_interface *DB;
#define VECTOR_INDEX(__vec,__idx) \
( VECTOR_DATA(__vec)[__idx] )
-
-
/// Returns the first value of the vector.
/// Assumes the array is not empty.
///
@@ -1119,8 +1085,6 @@ HPShared struct db_interface *DB;
#define VECTOR_FIRST(__vec) \
( VECTOR_INDEX(__vec,0) )
-
-
/// Returns the last value of the vector.
/// Assumes the array is not empty.
///
@@ -1129,8 +1093,6 @@ HPShared struct db_interface *DB;
#define VECTOR_LAST(__vec) \
( VECTOR_INDEX(__vec,VECTOR_LENGTH(__vec)-1) )
-
-
/// Resizes the vector.
/// Excess values are discarded, new positions are zeroed.
///
@@ -1159,8 +1121,6 @@ HPShared struct db_interface *DB;
} \
}while(0)
-
-
/// Ensures that the array has the target number of empty positions.
/// Increases the capacity in multiples of __step.
///
@@ -1176,8 +1136,6 @@ HPShared struct db_interface *DB;
} \
}while(0)
-
-
/// Inserts a zeroed value in the target index.
/// Assumes the index is valid and there is enough capacity.
///
@@ -1191,8 +1149,6 @@ HPShared struct db_interface *DB;
++VECTOR_LENGTH(__vec); /* increase length */ \
}while(0)
-
-
/// Inserts a value in the target index. (using the '=' operator)
/// Assumes the index is valid and there is enough capacity.
///
@@ -1207,8 +1163,6 @@ HPShared struct db_interface *DB;
++VECTOR_LENGTH(__vec); /* increase length */ \
}while(0)
-
-
/// Inserts a value in the target index. (using memcpy)
/// Assumes the index is valid and there is enough capacity.
///
@@ -1218,8 +1172,6 @@ HPShared struct db_interface *DB;
#define VECTOR_INSERTCOPY(__vec,__idx,__val) \
VECTOR_INSERTARRAY(__vec,__idx,&(__val),1)
-
-
/// Inserts the values of the array in the target index. (using memcpy)
/// Assumes the index is valid and there is enough capacity.
///
@@ -1235,8 +1187,6 @@ HPShared struct db_interface *DB;
VECTOR_LENGTH(__vec) += (__n); /* increase length */ \
}while(0)
-
-
/// Inserts a zeroed value in the end of the vector.
/// Assumes there is enough capacity.
///
@@ -1247,7 +1197,6 @@ HPShared struct db_interface *DB;
++VECTOR_LENGTH(__vec); /* increase length */ \
}while(0)
-
/// Inserts a value in the end of the vector. (using the '=' operator)
/// Assumes there is enough capacity.
///
@@ -1259,8 +1208,6 @@ HPShared struct db_interface *DB;
++VECTOR_LENGTH(__vec); /* increase length */ \
}while(0)
-
-
/// Inserts a value in the end of the vector. (using memcpy)
/// Assumes there is enough capacity.
///
@@ -1269,8 +1216,6 @@ HPShared struct db_interface *DB;
#define VECTOR_PUSHCOPY(__vec,__val) \
VECTOR_PUSHARRAY(__vec,&(__val),1)
-
-
/// Inserts the values of the array in the end of the vector. (using memcpy)
/// Assumes there is enough capacity.
///
@@ -1283,8 +1228,6 @@ HPShared struct db_interface *DB;
VECTOR_LENGTH(__vec) += (__n); /* increase length */ \
}while(0)
-
-
/// Removes and returns the last value of the vector.
/// Assumes the array is not empty.
///
@@ -1293,8 +1236,6 @@ HPShared struct db_interface *DB;
#define VECTOR_POP(__vec) \
( VECTOR_INDEX(__vec,--VECTOR_LENGTH(__vec)) )
-
-
/// Removes the last N values of the vector and returns the value of the last pop.
/// Assumes there are enough values.
///
@@ -1304,8 +1245,6 @@ HPShared struct db_interface *DB;
#define VECTOR_POPN(__vec,__n) \
( VECTOR_INDEX(__vec,(VECTOR_LENGTH(__vec)-=(__n))) )
-
-
/// Removes the target index from the vector.
/// Assumes the index is valid and there are enough values.
///
@@ -1314,8 +1253,6 @@ HPShared struct db_interface *DB;
#define VECTOR_ERASE(__vec,__idx) \
VECTOR_ERASEN(__vec,__idx,1)
-
-
/// Removes N values from the target index of the vector.
/// Assumes the index is valid and there are enough values.
///
@@ -1329,8 +1266,6 @@ HPShared struct db_interface *DB;
VECTOR_LENGTH(__vec) -= (__n); /* decrease length */ \
}while(0)
-
-
/// Clears the vector, freeing allocated data.
///
/// @param __vec Vector
@@ -1344,77 +1279,57 @@ HPShared struct db_interface *DB;
} \
}while(0)
-
-
/////////////////////////////////////////////////////////////////////
// Binary heap library based on defines. (uses the vector defines above)
// uses aMalloc, aRealloc, aFree
// WARNING: BHEAP implementation details affect behaviour of A* pathfinding
-
-
/// Declares an anonymous binary heap struct.
///
/// @param __type Type of data
#define BHEAP_DECL(__type) VECTOR_DECL(__type)
-
-
/// Declares a named binary heap struct.
///
/// @param __name Structure name
/// @param __type Type of data
#define BHEAP_STRUCT_DECL(__name,__type) VECTOR_STRUCT_DECL(__name,__type)
-
-
/// Declares and initializes an anonymous binary heap variable.
///
/// @param __type Type of data
/// @param __var Variable name
#define BHEAP_VAR(__type,__var) VECTOR_VAR(__type,__var)
-
-
/// Declares and initializes a named binary heap variable.
///
/// @param __name Structure name
/// @param __var Variable name
#define BHEAP_STRUCT_VAR(__name,__var) VECTOR_STRUCT_VAR(__name,__var)
-
-
/// Initializes a heap.
///
/// @param __heap Binary heap
#define BHEAP_INIT(__heap) VECTOR_INIT(__heap)
-
-
/// Returns the internal array of values.
///
/// @param __heap Binary heap
/// @return Array of values
#define BHEAP_DATA(__heap) VECTOR_DATA(__heap)
-
-
/// Returns the length of the heap.
///
/// @param __heap Binary heap
/// @return Length
#define BHEAP_LENGTH(__heap) VECTOR_LENGTH(__heap)
-
-
/// Returns the capacity of the heap.
///
/// @param __heap Binary heap
/// @return Capacity
#define BHEAP_CAPACITY(__heap) VECTOR_CAPACITY(__heap)
-
-
/// Ensures that the heap has the target number of empty positions.
/// Increases the capacity in multiples of __step.
///
@@ -1423,8 +1338,6 @@ HPShared struct db_interface *DB;
/// @param __step Increase
#define BHEAP_ENSURE(__heap,__n,__step) VECTOR_ENSURE(__heap,__n,__step)
-
-
/// Returns the top value of the heap.
/// Assumes the heap is not empty.
///
@@ -1432,8 +1345,6 @@ HPShared struct db_interface *DB;
/// @return Value at the top
#define BHEAP_PEEK(__heap) VECTOR_INDEX(__heap,0)
-
-
/// Inserts a value in the heap. (using the '=' operator)
/// Assumes there is enough capacity.
///
@@ -1460,8 +1371,6 @@ HPShared struct db_interface *DB;
} \
}while(0)
-
-
/// See BHEAP_PUSH. Version used by A* implementation, matching client bheap.
///
/// @param __heap Binary heap
@@ -1475,8 +1384,6 @@ HPShared struct db_interface *DB;
BHEAP_SIFTDOWN(__heap,0,_i_,__topcmp,__swp); \
}while(0)
-
-
/// Removes the top value of the heap. (using the '=' operator)
/// Assumes the heap is not empty.
///
@@ -1490,8 +1397,6 @@ HPShared struct db_interface *DB;
/// @param __swp Swapper
#define BHEAP_POP(__heap,__topcmp,__swp) BHEAP_POPINDEX(__heap,0,__topcmp,__swp)
-
-
/// See BHEAP_POP. Version used by A* implementation, matching client bheap.
///
/// @param __heap Binary heap
@@ -1505,8 +1410,6 @@ HPShared struct db_interface *DB;
BHEAP_SIFTUP(__heap,0,__topcmp,__swp); \
}while(0)
-
-
/// Removes the target value of the heap. (using the '=' operator)
/// Assumes the index exists.
///
@@ -1553,8 +1456,6 @@ HPShared struct db_interface *DB;
} \
}while(0)
-
-
/// Follow path up towards (but not all the way to) the root, swapping nodes until finding
/// a place where the new item that was placed at __idx fits.
/// Only goes as high as __startidx (usually 0).
@@ -1577,8 +1478,6 @@ HPShared struct db_interface *DB;
} \
}while(0)
-
-
/// Repeatedly swap the smaller child with parent, after placing a new item at __idx.
///
/// @param __heap Binary heap
@@ -1607,8 +1506,6 @@ HPShared struct db_interface *DB;
BHEAP_SIFTDOWN(__heap,__idx,_i_,__topcmp,__swp); \
}while(0)
-
-
/// Call this after modifying the item at __idx__ to restore the heap
///
/// @param __heap Binary heap
@@ -1621,15 +1518,11 @@ HPShared struct db_interface *DB;
BHEAP_SIFTUP(__heap,__idx,__topcmp,__swp); \
}while(0)
-
-
/// Clears the binary heap, freeing allocated data.
///
/// @param __heap Binary heap
#define BHEAP_CLEAR(__heap) VECTOR_CLEAR(__heap)
-
-
/// Generic comparator for a min-heap. (minimum value at top)
/// Returns -1 if v1 is smaller, 1 if v2 is smaller, 0 if equal.
///
@@ -1638,8 +1531,6 @@ HPShared struct db_interface *DB;
/// @return negative if v1 is top, positive if v2 is top, 0 if equal
#define BHEAP_MINTOPCMP(v1,v2) ( v1 == v2 ? 0 : v1 < v2 ? -1 : 1 )
-
-
/// Generic comparator for a max-heap. (maximum value at top)
/// Returns -1 if v1 is bigger, 1 if v2 is bigger, 0 if equal.
///
@@ -1648,6 +1539,4 @@ HPShared struct db_interface *DB;
/// @return negative if v1 is top, positive if v2 is top, 0 if equal
#define BHEAP_MAXTOPCMP(v1,v2) ( v1 == v2 ? 0 : v1 > v2 ? -1 : 1 )
-
-
#endif /* COMMON_DB_H */
diff --git a/src/common/grfio.c b/src/common/grfio.c
index 614678da8..b59c2b63d 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -47,7 +47,6 @@ typedef struct FILELIST {
// (NOTE: probably meant to be used to override grf contents by files in the data directory)
//#define GRFIO_LOCAL
-
// stores info about every loaded file
FILELIST* filelist = NULL;
int filelist_entrys = 0;
@@ -61,14 +60,12 @@ int gentry_maxentry = 0;
// the path to the data directory
char data_dir[1024] = "";
-
// little endian char array to uint conversion
static unsigned int getlong(unsigned char* p)
{
return (p[0] << 0 | p[1] << 8 | p[2] << 16 | p[3] << 24);
}
-
static void NibbleSwap(unsigned char* src, int len)
{
while( len > 0 )
@@ -79,7 +76,6 @@ static void NibbleSwap(unsigned char* src, int len)
}
}
-
/// Substitutes some specific values for others, leaves rest intact. Obfuscation.
/// NOTE: Operation is symmetric (calling it twice gives back the original input).
static uint8_t grf_substitution(uint8_t in)
@@ -142,7 +138,6 @@ static void grf_shuffle_dec(BIT64* src)
*src = out;
}
-
static void grf_decode_header(unsigned char* buf, size_t len)
{
BIT64* p = (BIT64*)buf;
@@ -156,7 +151,6 @@ static void grf_decode_header(unsigned char* buf, size_t len)
// the rest is plaintext, done.
}
-
static void grf_decode_full(unsigned char* buf, size_t len, int cycle)
{
BIT64* p = (BIT64*)buf;
@@ -195,7 +189,6 @@ static void grf_decode_full(unsigned char* buf, size_t len, int cycle)
}
}
-
/// Decodes grf data.
/// @param buf data to decode (in-place)
/// @param len length of the data
@@ -235,7 +228,6 @@ static void grf_decode(unsigned char* buf, size_t len, char entry_type, int entr
}
}
-
/******************************************************
*** Zlib Subroutines ***
******************************************************/
@@ -246,14 +238,12 @@ unsigned long grfio_crc32(const unsigned char* buf, unsigned int len)
return crc32(crc32(0L, Z_NULL, 0), buf, len);
}
-
/// zlib uncompress
int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen)
{
return uncompress((Bytef*)dest, destLen, (const Bytef*)source, sourceLen);
}
-
/// zlib compress
int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen) {
if( *destLen == 0 ) /* [Ind/Hercules] */
@@ -264,7 +254,6 @@ int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned
return compress((Bytef*)dest, destLen, (const Bytef*)source, sourceLen);
}
-
/***********************************************************
*** File List Subroutines ***
***********************************************************/
@@ -370,12 +359,10 @@ static void filelist_compact(void)
}
}
-
/***********************************************************
*** Grfio Subroutines ***
***********************************************************/
-
/// Combines are resource path with the data folder location to create local resource path.
static void grfio_localpath_create(char* buffer, size_t size, const char* filename)
{
@@ -399,7 +386,6 @@ static void grfio_localpath_create(char* buffer, size_t size, const char* filena
buffer[i] = '/';
}
-
/// Reads a file into a newly allocated buffer (from grf or data directory).
void *grfio_reads(const char *fname, int *size)
{
@@ -449,7 +435,7 @@ void *grfio_reads(const char *fname, int *size)
// Archive[GRF] File Read
char *grfname = gentry_table[entry->gentry - 1];
FILE *in = fopen(grfname, "rb");
-
+
if (in != NULL) {
int fsize = entry->srclen_aligned;
unsigned char *buf = (unsigned char *)aMalloc(fsize);
@@ -496,7 +482,6 @@ void *grfio_reads(const char *fname, int *size)
return NULL;
}
-
/// Decodes encrypted filename from a version 01xx grf index.
static char* decode_filename(unsigned char* buf, int len)
{
@@ -508,7 +493,6 @@ static char* decode_filename(unsigned char* buf, int len)
return (char*)buf;
}
-
/// Compares file extension against known large file types.
/// @return true if the file should undergo full mode 0 decryption, and true otherwise.
static bool isFullEncrypt(const char* fname)
@@ -525,7 +509,6 @@ static bool isFullEncrypt(const char* fname)
return true;
}
-
/// Loads all entries in the specified grf file into the filelist.
/// @param gentry index of the grf file name in the gentry_table
static int grfio_entryread(const char *grfname, int gentry)
@@ -691,7 +674,6 @@ static int grfio_entryread(const char *grfname, int gentry)
return 0; // 0:no error
}
-
static bool grfio_parse_restable_row(const char* row)
{
char w1[256], w2[256];
@@ -733,7 +715,6 @@ static bool grfio_parse_restable_row(const char* row)
return false;
}
-
/// Grfio Resource file check.
static void grfio_resourcecheck(void)
{
@@ -785,7 +766,6 @@ static void grfio_resourcecheck(void)
}
}
-
/// Reads a grf file and adds it to the list.
static int grfio_add(const char* fname)
{
@@ -802,7 +782,6 @@ static int grfio_add(const char* fname)
return grfio_entryread(fname, gentry_entrys - 1);
}
-
/// Finalizes grfio.
void grfio_final(void)
{
@@ -829,7 +808,6 @@ void grfio_final(void)
gentry_entrys = gentry_maxentry = 0;
}
-
/// Initializes grfio.
void grfio_init(const char* fname)
{
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 1567f20be..75b62fdc4 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -333,18 +333,15 @@ enum {
OPTION_DRAGON5 = 0x04000000,
OPTION_HANBOK = 0x08000000,
OPTION_OKTOBERFEST = 0x10000000,
-
#ifndef NEW_CARTS
OPTION_CART1 = 0x00000008,
OPTION_CART2 = 0x00000080,
OPTION_CART3 = 0x00000100,
OPTION_CART4 = 0x00000200,
OPTION_CART5 = 0x00000400,
-
/* compound constant for older carts */
OPTION_CART = OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5,
#endif
-
// compound constants
OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5,
OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST,
@@ -757,7 +754,6 @@ enum {
GD_MAX,
};
-
//These mark the ID of the jobs, as expected by the client. [Skotlex]
enum {
JOB_NOVICE,
diff --git a/src/common/mutex.c b/src/common/mutex.c
index 5dfb3d01c..715609628 100644
--- a/src/common/mutex.c
+++ b/src/common/mutex.c
@@ -25,7 +25,6 @@ struct ramutex{
#endif
};
-
struct racond{
#ifdef WIN32
HANDLE events[2];
@@ -40,14 +39,12 @@ struct racond{
#endif
};
-
////////////////////
// Mutex
//
// Implementation:
//
-
ramutex *ramutex_create(void) {
struct ramutex *m;
@@ -66,7 +63,6 @@ ramutex *ramutex_create(void) {
return m;
}//end: ramutex_create()
-
void ramutex_destroy(ramutex *m) {
#ifdef WIN32
@@ -79,7 +75,6 @@ void ramutex_destroy(ramutex *m) {
}//end: ramutex_destroy()
-
void ramutex_lock(ramutex *m) {
#ifdef WIN32
@@ -89,7 +84,6 @@ void ramutex_lock(ramutex *m) {
#endif
}//end: ramutex_lock
-
bool ramutex_trylock(ramutex *m) {
#ifdef WIN32
if(TryEnterCriticalSection(&m->hMutex) != FALSE)
@@ -104,7 +98,6 @@ bool ramutex_trylock(ramutex *m) {
#endif
}//end: ramutex_trylock()
-
void ramutex_unlock(ramutex *m) {
#ifdef WIN32
LeaveCriticalSection(&m->hMutex);
@@ -114,8 +107,6 @@ void ramutex_unlock(ramutex *m) {
}//end: ramutex_unlock()
-
-
///////////////
// Condition Variables
//
@@ -143,7 +134,6 @@ racond *racond_create(void) {
return c;
}//end: racond_create()
-
void racond_destroy(racond *c) {
#ifdef WIN32
CloseHandle( c->events[ EVENT_COND_SIGNAL ] );
@@ -156,14 +146,12 @@ void racond_destroy(racond *c) {
aFree(c);
}//end: racond_destroy()
-
void racond_wait(racond *c, ramutex *m, sysint timeout_ticks) {
#ifdef WIN32
register DWORD ms;
int result;
bool is_last = false;
-
EnterCriticalSection(&c->waiters_lock);
c->nWaiters++;
LeaveCriticalSection(&c->waiters_lock);
@@ -191,7 +179,6 @@ void racond_wait(racond *c, ramutex *m, sysint timeout_ticks) {
if(is_last == true)
ResetEvent( c->events[EVENT_COND_BROADCAST] );
-
ramutex_lock(m);
#else
@@ -210,7 +197,6 @@ void racond_wait(racond *c, ramutex *m, sysint timeout_ticks) {
#endif
}//end: racond_wait()
-
void racond_signal(racond *c) {
#ifdef WIN32
# if 0
@@ -228,7 +214,6 @@ void racond_signal(racond *c) {
#endif
}//end: racond_signal()
-
void racond_broadcast(racond *c) {
#ifdef WIN32
# if 0
@@ -245,5 +230,3 @@ void racond_broadcast(racond *c) {
pthread_cond_broadcast(&c->hCond);
#endif
}//end: racond_broadcast()
-
-
diff --git a/src/common/nullpo.c b/src/common/nullpo.c
index 829ba4aab..98faa9f06 100644
--- a/src/common/nullpo.c
+++ b/src/common/nullpo.c
@@ -58,6 +58,5 @@ void assert_report(const char *file, int line, const char *func, const char *tar
**/
void nullpo_defaults(void) {
nullpo = &nullpo_s;
-
nullpo->assert_report = assert_report;
}
diff --git a/src/common/socket.c b/src/common/socket.c
index c4cc4a329..de8ca4682 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -113,7 +113,6 @@ int sock2fd(SOCKET s)
return fd;
}
-
/// Inserts the socket into the global array of sockets.
/// Returns a new fd associated with the socket.
/// If there are too many sockets it closes the socket, sets an error and
@@ -293,7 +292,6 @@ void set_defaultparse(ParseFunc defaultparse)
default_func_parse = defaultparse;
}
-
/*======================================
* CORE : Socket options
*--------------------------------------*/
@@ -1066,12 +1064,12 @@ static int connect_check_clear(int tid, int64 tick, int id, intptr_t data) {
int list = 0;
ConnectHistory *hist = NULL;
DBIterator *iter;
-
+
if( !db_size(connect_history) )
return 0;
-
+
iter = db_iterator(connect_history);
-
+
for( hist = dbi_first(iter); dbi_exists(iter); hist = dbi_next(iter) ){
if( (!hist->ddos && DIFF_TICK(tick,hist->tick) > ddos_interval*3) ||
(hist->ddos && DIFF_TICK(tick,hist->tick) > ddos_autoreset) )
@@ -1081,13 +1079,12 @@ static int connect_check_clear(int tid, int64 tick, int id, intptr_t data) {
}
list++;
}
-
dbi_destroy(iter);
-
+
if( access_debug ){
ShowInfo("connect_check_clear: Cleared %d of %d from IP list.\n", clear, list);
}
-
+
return list;
}
@@ -1206,7 +1203,6 @@ int socket_config_read(const char* cfgName)
return 0;
}
-
void socket_final(void)
{
int i;
diff --git a/src/common/sql.c b/src/common/sql.c
index 0ca51e272..ee759eb61 100644
--- a/src/common/sql.c
+++ b/src/common/sql.c
@@ -36,8 +36,6 @@ struct Sql {
int keepalive;
};
-
-
// Column length receiver.
// Takes care of the possible size mismatch between uint32 and unsigned long.
struct s_column_length {
@@ -46,8 +44,6 @@ struct s_column_length {
};
typedef struct s_column_length s_column_length;
-
-
/// Sql statement
struct SqlStmt {
StringBuf buf;
@@ -61,14 +57,10 @@ struct SqlStmt {
bool bind_columns;
};
-
-
///////////////////////////////////////////////////////////////////////////////
// Sql Handle
///////////////////////////////////////////////////////////////////////////////
-
-
/// Allocates and initializes a new Sql handle.
Sql* Sql_Malloc(void)
{
@@ -84,8 +76,6 @@ Sql* Sql_Malloc(void)
return self;
}
-
-
static int Sql_P_Keepalive(Sql* self);
/// Establishes a connection.
@@ -111,8 +101,6 @@ int Sql_Connect(Sql* self, const char* user, const char* passwd, const char* hos
return SQL_SUCCESS;
}
-
-
/// Retrieves the timeout of the connection.
int Sql_GetTimeout(Sql* self, uint32* out_timeout)
{
@@ -130,8 +118,6 @@ int Sql_GetTimeout(Sql* self, uint32* out_timeout)
return SQL_ERROR;
}
-
-
/// Retrieves the name of the columns of a table into out_buf, with the separator after each name.
int Sql_GetColumnNames(Sql* self, const char* table, char* out_buf, size_t buf_len, char sep)
{
@@ -160,8 +146,6 @@ int Sql_GetColumnNames(Sql* self, const char* table, char* out_buf, size_t buf_l
return SQL_SUCCESS;
}
-
-
/// Changes the encoding of the connection.
int Sql_SetEncoding(Sql* self, const char* encoding)
{
@@ -170,8 +154,6 @@ int Sql_SetEncoding(Sql* self, const char* encoding)
return SQL_ERROR;
}
-
-
/// Pings the connection.
int Sql_Ping(Sql* self)
{
@@ -180,8 +162,6 @@ int Sql_Ping(Sql* self)
return SQL_ERROR;
}
-
-
/// Wrapper function for Sql_Ping.
///
/// @private
@@ -193,8 +173,6 @@ static int Sql_P_KeepaliveTimer(int tid, int64 tick, int id, intptr_t data)
return 0;
}
-
-
/// Establishes keepalive (periodic ping) on the connection.
///
/// @return the keepalive timer id, or INVALID_TIMER
@@ -218,8 +196,6 @@ static int Sql_P_Keepalive(Sql* self)
return timer->add_interval(timer->gettick() + ping_interval*1000, Sql_P_KeepaliveTimer, 0, (intptr_t)self, ping_interval*1000);
}
-
-
/// Escapes a string.
size_t Sql_EscapeString(Sql* self, char *out_to, const char *from)
{
@@ -229,8 +205,6 @@ size_t Sql_EscapeString(Sql* self, char *out_to, const char *from)
return (size_t)mysql_escape_string(out_to, from, (unsigned long)strlen(from));
}
-
-
/// Escapes a string.
size_t Sql_EscapeStringLen(Sql* self, char *out_to, const char *from, size_t from_len)
{
@@ -240,8 +214,6 @@ size_t Sql_EscapeStringLen(Sql* self, char *out_to, const char *from, size_t fro
return (size_t)mysql_escape_string(out_to, from, (unsigned long)from_len);
}
-
-
/// Executes a query.
int Sql_Query(Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3)));
int Sql_Query(Sql *self, const char *query, ...) {
@@ -255,8 +227,6 @@ int Sql_Query(Sql *self, const char *query, ...) {
return res;
}
-
-
/// Executes a query.
int Sql_QueryV(Sql* self, const char* query, va_list args)
{
@@ -282,8 +252,6 @@ int Sql_QueryV(Sql* self, const char* query, va_list args)
return SQL_SUCCESS;
}
-
-
/// Executes a query.
int Sql_QueryStr(Sql* self, const char* query)
{
@@ -309,8 +277,6 @@ int Sql_QueryStr(Sql* self, const char* query)
return SQL_SUCCESS;
}
-
-
/// Returns the number of the AUTO_INCREMENT column of the last INSERT/UPDATE query.
uint64 Sql_LastInsertId(Sql* self)
{
@@ -320,8 +286,6 @@ uint64 Sql_LastInsertId(Sql* self)
return 0;
}
-
-
/// Returns the number of columns in each row of the result.
uint32 Sql_NumColumns(Sql* self)
{
@@ -330,8 +294,6 @@ uint32 Sql_NumColumns(Sql* self)
return 0;
}
-
-
/// Returns the number of rows in the result.
uint64 Sql_NumRows(Sql* self)
{
@@ -340,8 +302,6 @@ uint64 Sql_NumRows(Sql* self)
return 0;
}
-
-
/// Fetches the next row.
int Sql_NextRow(Sql* self) {
if( self && self->result ) {
@@ -357,8 +317,6 @@ int Sql_NextRow(Sql* self) {
return SQL_ERROR;
}
-
-
/// Gets the data of a column.
int Sql_GetData(Sql* self, size_t col, char** out_buf, size_t* out_len)
{
@@ -375,8 +333,6 @@ int Sql_GetData(Sql* self, size_t col, char** out_buf, size_t* out_len)
return SQL_ERROR;
}
-
-
/// Frees the result of the query.
void Sql_FreeResult(Sql* self) {
if( self && self->result ) {
@@ -387,8 +343,6 @@ void Sql_FreeResult(Sql* self) {
}
}
-
-
/// Shows debug information (last query).
void Sql_ShowDebug_(Sql* self, const char* debug_file, const unsigned long debug_line)
{
@@ -400,8 +354,6 @@ void Sql_ShowDebug_(Sql* self, const char* debug_file, const unsigned long debug
ShowDebug("at %s:%lu\n", debug_file, debug_line);
}
-
-
/// Frees a Sql handle returned by Sql_Malloc.
void Sql_Free(Sql* self) {
if( self )
@@ -414,14 +366,10 @@ void Sql_Free(Sql* self) {
}
}
-
-
///////////////////////////////////////////////////////////////////////////////
// Prepared Statements
///////////////////////////////////////////////////////////////////////////////
-
-
/// Returns the mysql integer type for the target size.
///
/// @private
@@ -439,8 +387,6 @@ static enum enum_field_types Sql_P_SizeToMysqlIntType(int sz)
}
}
-
-
/// Binds a parameter/result.
///
/// @private
@@ -514,8 +460,6 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type,
return SQL_SUCCESS;
}
-
-
/// Prints debug information about a field (type and length).
///
/// @private
@@ -551,8 +495,6 @@ static void Sql_P_ShowDebugMysqlFieldInfo(const char* prefix, enum enum_field_ty
ShowDebug("%stype=%s%s, length=%lu%s\n", prefix, sign, type_string, length, length_postfix);
}
-
-
/// Reports debug information about a truncated column.
///
/// @private
@@ -575,8 +517,6 @@ static void SqlStmt_P_ShowDebugTruncatedColumn(SqlStmt* self, size_t i)
mysql_free_result(meta);
}
-
-
/// Allocates and initializes a new SqlStmt handle.
SqlStmt* SqlStmt_Malloc(Sql* sql) {
SqlStmt* self;
@@ -604,8 +544,6 @@ SqlStmt* SqlStmt_Malloc(Sql* sql) {
return self;
}
-
-
/// Prepares the statement.
int SqlStmt_Prepare(SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3)));
int SqlStmt_Prepare(SqlStmt *self, const char *query, ...) {
@@ -619,8 +557,6 @@ int SqlStmt_Prepare(SqlStmt *self, const char *query, ...) {
return res;
}
-
-
/// Prepares the statement.
int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args)
{
@@ -641,8 +577,6 @@ int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args)
return SQL_SUCCESS;
}
-
-
/// Prepares the statement.
int SqlStmt_PrepareStr(SqlStmt* self, const char* query)
{
@@ -663,8 +597,6 @@ int SqlStmt_PrepareStr(SqlStmt* self, const char* query)
return SQL_SUCCESS;
}
-
-
/// Returns the number of parameters in the prepared statement.
size_t SqlStmt_NumParams(SqlStmt* self)
{
@@ -674,8 +606,6 @@ size_t SqlStmt_NumParams(SqlStmt* self)
return 0;
}
-
-
/// Binds a parameter to a buffer.
int SqlStmt_BindParam(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, void* buffer, size_t buffer_len)
{
@@ -704,8 +634,6 @@ int SqlStmt_BindParam(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, v
return SQL_SUCCESS;// out of range - ignore
}
-
-
/// Executes the prepared statement.
int SqlStmt_Execute(SqlStmt* self)
{
@@ -731,8 +659,6 @@ int SqlStmt_Execute(SqlStmt* self)
return SQL_SUCCESS;
}
-
-
/// Returns the number of the AUTO_INCREMENT column of the last INSERT/UPDATE statement.
uint64 SqlStmt_LastInsertId(SqlStmt* self)
{
@@ -742,8 +668,6 @@ uint64 SqlStmt_LastInsertId(SqlStmt* self)
return 0;
}
-
-
/// Returns the number of columns in each row of the result.
size_t SqlStmt_NumColumns(SqlStmt* self)
{
@@ -753,8 +677,6 @@ size_t SqlStmt_NumColumns(SqlStmt* self)
return 0;
}
-
-
/// Binds the result of a column to a buffer.
int SqlStmt_BindColumn(SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null) {
if (self == NULL)
@@ -796,8 +718,6 @@ int SqlStmt_BindColumn(SqlStmt *self, size_t idx, enum SqlDataType buffer_type,
}
}
-
-
/// Returns the number of rows in the result.
uint64 SqlStmt_NumRows(SqlStmt* self)
{
@@ -807,8 +727,6 @@ uint64 SqlStmt_NumRows(SqlStmt* self)
return 0;
}
-
-
/// Fetches the next row.
int SqlStmt_NextRow(SqlStmt* self)
{
@@ -892,8 +810,6 @@ int SqlStmt_NextRow(SqlStmt* self)
return SQL_SUCCESS;
}
-
-
/// Frees the result of the statement execution.
void SqlStmt_FreeResult(SqlStmt* self)
{
@@ -901,8 +817,6 @@ void SqlStmt_FreeResult(SqlStmt* self)
mysql_stmt_free_result(self->stmt);
}
-
-
/// Shows debug information (with statement).
void SqlStmt_ShowDebug_(SqlStmt* self, const char* debug_file, const unsigned long debug_line)
{
@@ -914,8 +828,6 @@ void SqlStmt_ShowDebug_(SqlStmt* self, const char* debug_file, const unsigned lo
ShowDebug("at %s:%lu\n", debug_file, debug_line);
}
-
-
/// Frees a SqlStmt returned by SqlStmt_Malloc.
void SqlStmt_Free(SqlStmt* self)
{
diff --git a/src/common/sql.h b/src/common/sql.h
index 7fb4aabe8..fc1562347 100644
--- a/src/common/sql.h
+++ b/src/common/sql.h
@@ -142,8 +142,6 @@ struct sql_interface {
/// Allocates and initializes a new Sql handle.
struct Sql *(*Malloc) (void);
-
-
///////////////////////////////////////////////////////////////////////////////
// Prepared Statements
///////////////////////////////////////////////////////////////////////////////
@@ -157,7 +155,6 @@ struct sql_interface {
// 1) SELECT col FROM table WHERE id=?
// 2) INSERT INTO table(col1,col2) VALUES(?,?)
-
/*=====================================
SQL Statement interface [Susu]
*-------------------------------------*/
@@ -169,8 +166,6 @@ struct sql_interface {
/// @return SqlStmt handle or NULL if an error occurred
struct SqlStmt* (*StmtMalloc)(Sql* sql);
-
-
/// Prepares the statement.
/// Any previous result is freed and all parameter bindings are removed.
/// The query is constructed as if it was sprintf.
@@ -185,8 +180,6 @@ struct sql_interface {
/// @return SQL_SUCCESS or SQL_ERROR
int (*StmtPrepareV)(SqlStmt* self, const char* query, va_list args);
-
-
/// Prepares the statement.
/// Any previous result is freed and all parameter bindings are removed.
/// The query is used directly.
@@ -194,15 +187,11 @@ struct sql_interface {
/// @return SQL_SUCCESS or SQL_ERROR
int (*StmtPrepareStr)(SqlStmt* self, const char* query);
-
-
/// Returns the number of parameters in the prepared statement.
///
/// @return Number or parameters
size_t (*StmtNumParams)(SqlStmt* self);
-
-
/// Binds a parameter to a buffer.
/// The buffer data will be used when the statement is executed.
/// All parameters should have bindings.
@@ -210,30 +199,22 @@ struct sql_interface {
/// @return SQL_SUCCESS or SQL_ERROR
int (*StmtBindParam)(SqlStmt* self, size_t idx, SqlDataType buffer_type, void* buffer, size_t buffer_len);
-
-
/// Executes the prepared statement.
/// Any previous result is freed and all column bindings are removed.
///
/// @return SQL_SUCCESS or SQL_ERROR
int (*StmtExecute)(SqlStmt* self);
-
-
/// Returns the number of the AUTO_INCREMENT column of the last INSERT/UPDATE statement.
///
/// @return Value of the auto-increment column
uint64 (*StmtLastInsertId)(SqlStmt* self);
-
-
/// Returns the number of columns in each row of the result.
///
/// @return Number of columns
size_t (*StmtNumColumns)(SqlStmt* self);
-
-
/// Binds the result of a column to a buffer.
/// The buffer will be filled with data when the next row is fetched.
/// For string/enum buffer types there has to be enough space for the data
@@ -242,23 +223,17 @@ struct sql_interface {
/// @return SQL_SUCCESS or SQL_ERROR
int (*StmtBindColumn)(SqlStmt* self, size_t idx, SqlDataType buffer_type, void* buffer, size_t buffer_len, uint32* out_length, int8* out_is_null);
-
-
/// Returns the number of rows in the result.
///
/// @return Number of rows
uint64 (*StmtNumRows)(SqlStmt* self);
-
-
/// Fetches the next row.
/// All column bindings will be filled with data.
///
/// @return SQL_SUCCESS, SQL_ERROR or SQL_NO_DATA
int (*StmtNextRow)(SqlStmt* self);
-
-
/// Frees the result of the statement execution.
void (*StmtFreeResult)(SqlStmt* self);
diff --git a/src/common/strlib.c b/src/common/strlib.c
index 024b73e59..fcd1b483b 100644
--- a/src/common/strlib.c
+++ b/src/common/strlib.c
@@ -423,8 +423,6 @@ bool strlib_bin2hex(char *output, unsigned char *input, size_t count)
return true;
}
-
-
/////////////////////////////////////////////////////////////////////
/// Parses a single field in a delim-separated string.
/// The delimiter after the field is skipped.
@@ -582,7 +580,6 @@ int sv_parse_next(struct s_svstate* svstate)
return 1;
}
-
/// Parses a delim-separated string.
/// Starts parsing at startoff and fills the pos array with position pairs.
/// out_pos[0] and out_pos[1] are the start and end of line.
@@ -892,7 +889,6 @@ const char* skip_escaped_c(const char* p) {
return p;
}
-
/// Opens and parses a file containing delim-separated columns, feeding them to the specified callback function row by row.
/// Tracks the progress of the operation (current line number, number of successfully processed rows).
/// Returns 'true' if it was able to process the specified file, or 'false' if it could not be read.
@@ -970,7 +966,6 @@ bool sv_readdb(const char* directory, const char* filename, char delim, int minc
return true;
}
-
/////////////////////////////////////////////////////////////////////
// StringBuf - dynamic string
//
diff --git a/src/common/thread.c b/src/common/thread.c
index 9b9308d06..d5bbd7f97 100644
--- a/src/common/thread.c
+++ b/src/common/thread.c
@@ -48,12 +48,10 @@ struct rAthread {
#endif
};
-
#ifdef HAS_TLS
__thread int g_rathread_ID = -1;
#endif
-
///
/// Subystem Code
///
@@ -76,8 +74,6 @@ void rathread_init(void) {
}//end: rathread_init()
-
-
void rathread_final(void) {
register unsigned int i;
@@ -94,8 +90,6 @@ void rathread_final(void) {
}//end: rathread_final()
-
-
// gets called whenever a thread terminated ..
static void rat_thread_terminated(rAthread *handle) {
// Preserve handle->myID and handle->hThread, set everything else to its default value
@@ -131,7 +125,6 @@ static void *raThreadMainRedirector( void *p ){
#endif
-
ret = ((rAthread*)p)->proc( ((rAthread*)p)->param ) ;
#ifdef WIN32
@@ -146,10 +139,6 @@ static void *raThreadMainRedirector( void *p ){
#endif
}//end: raThreadMainRedirector()
-
-
-
-
///
/// API Level
///
@@ -157,7 +146,6 @@ rAthread *rathread_create(rAthreadProc entryPoint, void *param) {
return rathread_createEx( entryPoint, param, (1<<23) /*8MB*/, RAT_PRIO_NORMAL );
}//end: rathread_create()
-
rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio) {
#ifndef WIN32
pthread_attr_t attr;
@@ -166,13 +154,11 @@ rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack
unsigned int i;
rAthread *handle = NULL;
-
// given stacksize aligned to systems pagesize?
tmp = szStack % sysinfo->getpagesize();
if(tmp != 0)
szStack += tmp;
-
// Get a free Thread Slot.
for(i = 0; i < RA_THREADS_MAX; i++){
if(l_threads[i].proc == NULL){
@@ -208,7 +194,6 @@ rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack
return handle;
}//end: rathread_createEx
-
void rathread_destroy(rAthread *handle) {
#ifdef WIN32
if( TerminateThread(handle->hThread, 0) != FALSE){
@@ -253,7 +238,6 @@ rAthread *rathread_self(void) {
return NULL;
}//end: rathread_self()
-
int rathread_get_tid(void) {
#ifdef HAS_TLS
@@ -269,7 +253,6 @@ int rathread_get_tid(void) {
}//end: rathread_get_tid()
-
bool rathread_wait(rAthread *handle, void **out_exitCode) {
// Hint:
// no thread data cleanup routine call here!
@@ -286,18 +269,15 @@ bool rathread_wait(rAthread *handle, void **out_exitCode) {
}//end: rathread_wait()
-
void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio) {
handle->prio = RAT_PRIO_NORMAL;
//@TODO
}//end: rathread_prio_set()
-
RATHREAD_PRIO rathread_prio_get(rAthread *handle) {
return handle->prio;
}//end: rathread_prio_get()
-
void rathread_yield(void) {
#ifdef WIN32
SwitchToThread();
diff --git a/src/common/utils.c b/src/common/utils.c
index 3606c6755..f5eecb65d 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -60,7 +60,6 @@ void WriteDump(FILE* fp, const void* buffer, size_t length)
}
}
-
/// Dumps given buffer on the console.
void ShowDump(const void *buffer, size_t length) {
size_t i;
@@ -86,7 +85,6 @@ void ShowDump(const void *buffer, size_t length) {
}
}
-
#ifdef WIN32
static char* checkpath(char *path, const char *srcpath)
@@ -137,7 +135,6 @@ void findfile(const char *p, const char *pat, void (func)(const char*))
func( tmppath );
}
-
if( FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{
findfile(tmppath, pat, func);
@@ -155,7 +152,7 @@ static char* checkpath(char *path, const char*srcpath)
{
// just make sure the char*path is not const
char *p=path;
-
+
if(NULL!=path && NULL!=srcpath) {
while(*srcpath) {
if (*srcpath=='\\') {
@@ -349,7 +346,6 @@ const char* timestamp2string(char* str, size_t size, time_t timestamp, const cha
return str;
}
-
/* [Ind/Hercules] Caching */
bool HCache_check(const char *file)
{