int main(int argc, char *argv[]) { uint32_t i; uint32_t v; uint32_t h; uint32_t slots; const char *errstr; const char *e; char **occupied; char **t; int tn; Init_Stats(); if (argc != 3) exit(1); tn = strtonum(argv[1], 1, INT_MAX, &errstr); if (errstr) exit(1); t = table[tn-1]; slots = strtonum(argv[2], 0, INT_MAX, &errstr); if (errstr) exit(1); if (slots) { occupied = calloc(slots, sizeof(char *)); if (!occupied) exit(1); } else occupied = NULL; printf("/* File created by generate %d %d, do not edit */\n", tn, slots); for (i = 0; t[i] != NULL; i++) { e = NULL; v = ohash_interval(t[i], &e); if (slots) { h = v % slots; if (occupied[h]) { fprintf(stderr, "Collision: %s / %s (%d)\n", occupied[h], t[i], h); exit(1); } occupied[h] = t[i]; } i++; printf("#define K_%s %u\n", t[i], v); } if (slots) printf("#define MAGICSLOTS%d %u\n", tn, slots); exit(0); }
void Init(void) { Init_Timestamp(); Init_Stats(); Targ_Init(); Dir_Init(); /* Initialize directory structures so -I flags * can be processed correctly */ Parse_Init(); /* Need to initialize the paths of #include * directories */ Var_Init(); /* As well as the lists of variables for * parsing arguments */ Arch_Init(); Suff_Init(); }