fix dict size

This commit is contained in:
lxsang 2019-12-12 18:35:00 +01:00
parent fabe2e6e2a
commit 3f2af063aa
4 changed files with 12 additions and 12 deletions

Binary file not shown.

View File

@ -25,8 +25,8 @@ THE SOFTWARE.
dictionary dict()
{
dictionary d = (dictionary)malloc(HASHSIZE*sizeof(association));
for(int i=0; i< HASHSIZE;i++)
dictionary d = (dictionary)malloc(DHASHSIZE*sizeof(association));
for(int i=0; i< DHASHSIZE;i++)
d[i] = NULL;
return d;
}
@ -119,7 +119,7 @@ void free_association(association * asoc)
}
void freedict(dictionary dic){
for(int i = 0; i < HASHSIZE; i++)
for(int i = 0; i < DHASHSIZE; i++)
free_association(&(dic[i]));
free(dic);

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
#include "utils.h"
#define for_each_assoc(assoc, dic) \
for(int i = 0; i < HASHSIZE; i++) \
for(int i = 0; i < DHASHSIZE; i++) \
for(assoc = dic[i];assoc!= NULL; assoc = assoc->next)
/**

View File

@ -40,9 +40,9 @@ typedef struct{
int sock;
void* ssl;
char* ip;
#ifdef USE_OPENSSL
//#ifdef USE_OPENSSL
int status;
#endif
//#endif
time_t last_io;
} antd_client_t;
@ -66,14 +66,14 @@ typedef struct {
int connection;
int n_workers;
FILE* errorfp;
#ifdef DEBUG
// #ifdef DEBUG
FILE* logfp;
#endif
#ifdef USE_OPENSSL
// #endif
// #ifdef USE_OPENSSL
int usessl;
char* sslcert;
char* sslkey;
#endif
// #endif
}config_t;
typedef struct {
@ -83,9 +83,9 @@ typedef struct {
char*pdir;
int sport;
int raw_body;
#ifdef USE_OPENSSL
//#ifdef USE_OPENSSL
int usessl;
#endif
//#endif
} plugin_header_t;
void set_nonblock(int socket);