git-svn: trunk@4830
Török Edvin authored on 2009/02/19 04:53:28... | ... |
@@ -142,9 +142,9 @@ extern int cl_engine_free(struct cl_engine *engine); |
142 | 142 |
|
143 | 143 |
struct cl_stat { |
144 | 144 |
char *dir; |
145 |
- unsigned int entries; |
|
146 | 145 |
struct stat *stattab; |
147 | 146 |
char **statdname; |
147 |
+ unsigned int entries; |
|
148 | 148 |
}; |
149 | 149 |
|
150 | 150 |
struct cl_cvd { /* field no. */ |
... | ... |
@@ -152,6 +152,7 @@ struct cl_cvd { /* field no. */ |
152 | 152 |
unsigned int version; /* 3 */ |
153 | 153 |
unsigned int sigs; /* 4 */ |
154 | 154 |
unsigned int fl; /* 5 */ |
155 |
+ /* padding */ |
|
155 | 156 |
char *md5; /* 6 */ |
156 | 157 |
char *dsig; /* 7 */ |
157 | 158 |
char *builder; /* 8 */ |
... | ... |
@@ -426,7 +426,6 @@ int hashset_init(struct hashset* hs, size_t initial_capacity, uint8_t load_facto |
426 | 426 |
load_factor = 80; |
427 | 427 |
} |
428 | 428 |
initial_capacity = nearest_power(initial_capacity); |
429 |
- hs->load_factor = load_factor; |
|
430 | 429 |
hs->limit = initial_capacity * load_factor / 100; |
431 | 430 |
hs->capacity = initial_capacity; |
432 | 431 |
hs->mask = initial_capacity - 1; |
... | ... |
@@ -500,7 +499,7 @@ static int hashset_grow(struct hashset *hs) |
500 | 500 |
* will hash to different locations. */ |
501 | 501 |
cli_dbgmsg(MODULE_NAME "Growing hashset, used: %lu, capacity: %lu\n", hs->count, hs->capacity); |
502 | 502 |
/* create a bigger hashset */ |
503 |
- if((rc = hashset_init(&new_hs, hs->capacity << 1, hs->load_factor)) < 0) { |
|
503 |
+ if((rc = hashset_init(&new_hs, hs->capacity << 1, hs->limit*100/hs->capacity)) < 0) { |
|
504 | 504 |
return rc; |
505 | 505 |
} |
506 | 506 |
/* and copy keys */ |
... | ... |
@@ -90,11 +90,10 @@ int hashtab_store(const struct hashtable *s,FILE* out); |
90 | 90 |
struct hashset { |
91 | 91 |
uint32_t* keys; |
92 | 92 |
uint32_t* bitmap; |
93 |
- size_t capacity; |
|
94 |
- size_t mask; |
|
95 |
- size_t count; |
|
96 |
- size_t limit; |
|
97 |
- uint8_t load_factor; |
|
93 |
+ uint32_t capacity; |
|
94 |
+ uint32_t mask; |
|
95 |
+ uint32_t count; |
|
96 |
+ uint32_t limit; |
|
98 | 97 |
}; |
99 | 98 |
|
100 | 99 |
int hashset_init(struct hashset* hs, size_t initial_capacity, uint8_t load_factor); |
... | ... |
@@ -108,12 +108,12 @@ struct tokens { |
108 | 108 |
struct parser_state { |
109 | 109 |
unsigned long var_uniq; |
110 | 110 |
unsigned long syntax_errors; |
111 |
- unsigned int rec; |
|
112 | 111 |
struct scope *global; |
113 | 112 |
struct scope *current; |
114 | 113 |
struct scope *list; |
115 | 114 |
yyscan_t scanner; |
116 | 115 |
struct tokens tokens; |
116 |
+ unsigned int rec; |
|
117 | 117 |
}; |
118 | 118 |
|
119 | 119 |
static struct scope* scope_new(struct parser_state *state) |
... | ... |
@@ -372,8 +372,8 @@ struct dirent_data { |
372 | 372 |
char *filename; |
373 | 373 |
const char *dirname; |
374 | 374 |
struct stat *statbuf; |
375 |
- int is_dir;/* 0 - no, 1 - yes */ |
|
376 | 375 |
long ino; /* -1: inode not available */ |
376 |
+ int is_dir;/* 0 - no, 1 - yes */ |
|
377 | 377 |
}; |
378 | 378 |
|
379 | 379 |
/* sort files before directories, and lower inodes before higher inodes */ |
... | ... |
@@ -1281,7 +1281,7 @@ static int cli_loadmd5(FILE *fs, struct cl_engine *engine, unsigned int *signo, |
1281 | 1281 |
|
1282 | 1282 |
if(mode == MD5_MDB) { /* section MD5 */ |
1283 | 1283 |
if(!db->md5_sizes_hs.capacity) { |
1284 |
- hashset_init(&db->md5_sizes_hs, 32768, 80); |
|
1284 |
+ hashset_init(&db->md5_sizes_hs, 65536, 80); |
|
1285 | 1285 |
} |
1286 | 1286 |
hashset_addkey(&db->md5_sizes_hs, size); |
1287 | 1287 |
} |
... | ... |
@@ -353,7 +353,7 @@ int init_regex_list(struct regex_matcher* matcher) |
353 | 353 |
matcher->list_inited=1; |
354 | 354 |
matcher->list_built=0; |
355 | 355 |
matcher->list_loaded=0; |
356 |
- hashtab_init(&matcher->suffix_hash, 10); |
|
356 |
+ hashtab_init(&matcher->suffix_hash, 512); |
|
357 | 357 |
#ifdef USE_MPOOL |
358 | 358 |
matcher->mempool = mp; |
359 | 359 |
matcher->suffixes.mempool = mp; |
... | ... |
@@ -45,7 +45,6 @@ enum node_type { |
45 | 45 |
}; |
46 | 46 |
|
47 | 47 |
struct node { |
48 |
- enum node_type type; |
|
49 | 48 |
struct node *parent; |
50 | 49 |
union { |
51 | 50 |
struct { |
... | ... |
@@ -55,6 +54,7 @@ struct node { |
55 | 55 |
uint8_t* leaf_class_bitmap; |
56 | 56 |
uint8_t leaf_char; |
57 | 57 |
} u; |
58 |
+ enum node_type type; |
|
58 | 59 |
}; |
59 | 60 |
|
60 | 61 |
/* --- Prototypes --*/ |