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 dict()
{ {
dictionary d = (dictionary)malloc(HASHSIZE*sizeof(association)); dictionary d = (dictionary)malloc(DHASHSIZE*sizeof(association));
for(int i=0; i< HASHSIZE;i++) for(int i=0; i< DHASHSIZE;i++)
d[i] = NULL; d[i] = NULL;
return d; return d;
} }
@ -119,7 +119,7 @@ void free_association(association * asoc)
} }
void freedict(dictionary dic){ void freedict(dictionary dic){
for(int i = 0; i < HASHSIZE; i++) for(int i = 0; i < DHASHSIZE; i++)
free_association(&(dic[i])); free_association(&(dic[i]));
free(dic); free(dic);

View File

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

View File

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