summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/db.h10
-rw-r--r--src/common/malloc.c6
-rw-r--r--src/common/malloc.h2
-rw-r--r--src/common/socket.c6
-rw-r--r--src/common/timer.c14
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;