diff options
author | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-29 06:18:21 +0000 |
---|---|---|
committer | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-29 06:18:21 +0000 |
commit | c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8 (patch) | |
tree | 57a37cf82ced0b0b998b99e5dfdc27d62932420a /src/common | |
parent | 7bfe35400c79bf97a5b0bed9f170912c37cf9452 (diff) | |
download | hercules-c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8.tar.gz hercules-c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8.tar.bz2 hercules-c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8.tar.xz hercules-c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8.zip |
Fixe compile time problems with our mixed C++/C conformance
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1328 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/db.h | 10 | ||||
-rw-r--r-- | src/common/malloc.c | 6 | ||||
-rw-r--r-- | src/common/malloc.h | 2 | ||||
-rw-r--r-- | src/common/socket.c | 6 | ||||
-rw-r--r-- | src/common/timer.c | 14 |
5 files changed, 20 insertions, 18 deletions
diff --git a/src/common/db.h b/src/common/db.h index 8b37e15ad..6980099cf 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -18,6 +18,11 @@ struct dbn { struct dbn *prev; }; +struct db_free { + struct dbn *z; + struct dbn **root; +}; + struct dbt { int (*cmp)(struct dbt*,void*,void*); unsigned int (*hash)(struct dbt*,void*); @@ -30,10 +35,7 @@ struct dbt { int alloc_line; // DB?s // db_foreach 内部でdb_erase される対策として、 // db_foreach が終わるまでロックすることにする - struct db_free { - struct dbn *z; - struct dbn **root; - } *free_list; + struct db_free *free_list; int free_count; int free_max; int free_lock; diff --git a/src/common/malloc.c b/src/common/malloc.c index 747423b47..b562ca3c0 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -65,15 +65,15 @@ void* aRealloc_( void *p, size_t size, const char *file, int line, const char *f return ret; } -void* aStrdup_( const void *p, const char *file, int line, const char *func ) +char* aStrdup_( const void *p, const char *file, int line, const char *func ) { - void *ret; + char *ret; // printf("%s:%d: in func %s: strdup %p\n",file,line,func,p); #ifdef MEMWATCH ret=mwStrdup(p,file,line); #else - ret=strdup(p); + ret= strdup((char *) p); #endif if(ret==NULL){ printf("%s:%d: in func %s: strdup error out of memory!\n",file,line,func); diff --git a/src/common/malloc.h b/src/common/malloc.h index c59c08a4e..1bc0eb292 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -63,7 +63,7 @@ void* aCalloc_( size_t num, size_t size, const char *file, int line, const char *func ); void* aRealloc_( void *p, size_t size, const char *file, int line, const char *func ); void aFree_( void *p, const char *file, int line, const char *func ); - void* aStrdup_( const void *p, const char *file, int line, const char *func ); + char* aStrdup_( const void *p, const char *file, int line, const char *func ); # define aMalloc(n) aMalloc_(n,ALC_MARK) # define aMallocA(n) aMalloc_(n,ALC_MARK) diff --git a/src/common/socket.c b/src/common/socket.c index 1c4d5931a..70432eddf 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -678,7 +678,7 @@ static int connect_check_(unsigned int ip) { hist = hist->next; } // IPリストに無いので新規作成 - hist_new = aCalloc(1,sizeof(struct _connect_history)); + hist_new = (struct _connect_history *) aCalloc(1,sizeof(struct _connect_history)); hist_new->ip = ip; hist_new->tick = gettick(); if(connect_history[ip & 0xFFFF] != NULL) { @@ -791,12 +791,12 @@ int socket_config_read(const char *cfgName) { if(strcmpi(w2,"allow,deny")==0) access_order=ACO_ALLOW_DENY; if(strcmpi(w2,"mutual-failure")==0) access_order=ACO_MUTUAL_FAILTURE; } else if(strcmpi(w1,"allow")==0){ - access_allow = aRealloc(access_allow,(access_allownum+1)*sizeof(struct _access_control)); + access_allow = (struct _access_control *) aRealloc(access_allow,(access_allownum+1)*sizeof(struct _access_control)); if(access_ipmask(w2,&access_allow[access_allownum])) { access_allownum++; } } else if(strcmpi(w1,"deny")==0){ - access_deny = aRealloc(access_deny,(access_denynum+1)*sizeof(struct _access_control)); + access_deny = (struct _access_control *) aRealloc(access_deny,(access_denynum+1)*sizeof(struct _access_control)); if(access_ipmask(w2,&access_deny[access_denynum])) { access_denynum++; } diff --git a/src/common/timer.c b/src/common/timer.c index 6bf5cdbda..6a740d47a 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -54,9 +54,9 @@ int add_timer_func_list(int (*func)(int,unsigned int,int,int), char* name) { struct timer_func_list* tfl; //CALLOC(tfl, struct timer_func_list, 1); - tfl = aCalloc( sizeof(struct timer_func_list) , 1); + tfl = (struct timer_func_list*) aCalloc( sizeof(struct timer_func_list) , 1); //MALLOC(tfl->name, char, strlen(name) + 1); - tfl->name = aMalloc( strlen(name) + 1 ); + tfl->name = (char *) aMalloc( strlen(name) + 1 ); tfl->next = tfl_root; tfl->func = func; @@ -112,11 +112,11 @@ static void push_timer_heap(int index) { if (timer_heap_max == 0) { timer_heap_max = 256; //CALLOC(timer_heap, int, 256); - timer_heap = aCalloc( sizeof(int) , 256); + timer_heap = (int *) aCalloc( sizeof(int) , 256); } else { timer_heap_max += 256; //REALLOC(timer_heap, int, timer_heap_max); - timer_heap = aRealloc( timer_heap, sizeof(int) * timer_heap_max); + timer_heap = (int *) aRealloc( timer_heap, sizeof(int) * timer_heap_max); memset(timer_heap + (timer_heap_max - 256), 0, sizeof(int) * 256); } } @@ -178,11 +178,11 @@ int add_timer(unsigned int tick,int (*func)(int,unsigned int,int,int),int id,int if (timer_data_max == 0) { timer_data_max = 256; //CALLOC(timer_data, struct TimerData, timer_data_max); - timer_data = aCalloc( sizeof(struct TimerData) , timer_data_max); + timer_data = (struct TimerData*) aCalloc( sizeof(struct TimerData) , timer_data_max); } else { timer_data_max += 256; //REALLOC(timer_data, struct TimerData, timer_data_max); - timer_data = aRealloc( timer_data, sizeof(struct TimerData) * timer_data_max); + timer_data = (struct TimerData *) aRealloc( timer_data, sizeof(struct TimerData) * timer_data_max); memset(timer_data + (timer_data_max - 256), 0, sizeof(struct TimerData) * 256); } } @@ -267,7 +267,7 @@ int do_timer(unsigned int tick) { if (free_timer_list_pos >= free_timer_list_max) { free_timer_list_max += 256; //REALLOC(free_timer_list, int, free_timer_list_max); - free_timer_list = aRealloc(free_timer_list, sizeof(int) * free_timer_list_max); + free_timer_list = (int *) aRealloc(free_timer_list, sizeof(int) * free_timer_list_max); memset(free_timer_list + (free_timer_list_max - 256), 0, 256 * sizeof(int)); } free_timer_list[free_timer_list_pos++] = i; |