static void rebuild_cache() { free_arena(&cache_arena); init_arena(&cache_arena, 1024); rebuild_uid_cache(); rebuild_gid_cache(); qsort(uid_cache, uid_cache_size, sizeof(struct uid_cache_entry), uid_cache_uid_sortcmp); qsort(gid_cache, gid_cache_size, sizeof(struct gid_cache_entry), gid_cache_gid_sortcmp); }
static void test_equalities(uint32_t n) { uint32_t k, l; arena_t m; init_arena(&m); for (k=0; k<n; k++) { arena_push(&m); for (l=0; l<n; l++) { show_label(k); if (k != l) show_label(l); test_eq(&m, pos_occ(k), pos_occ(l)); test_eq(&m, pos_occ(k), neg_occ(l)); test_eq(&m, neg_occ(k), pos_occ(l)); test_eq(&m, neg_occ(k), neg_occ(l)); printf("\n"); } arena_pop(&m); } delete_arena(&m); }
int main(int argc, char **argv) { t_vm *vm; int i; if ((vm = malloc(sizeof(t_vm))) == NULL) my_print_error("Error with a memory allocation\n"); if ((vm->arena = malloc(sizeof(t_vm))) == NULL) my_print_error("Error with a memory allocation\n"); init_arena(vm->arena->arena, MEM_SIZE); check_arg(argc); i = check_dump(vm, argv); check_champ(vm, argc, argv, i); init_champs(vm); my_parsing(vm, argc, argv, i); init_mlx(vm); aff_grid(vm); my_hook(vm); corewar(vm); return (0); }
static void test_disjunctions(uint32_t n) { uint32_t t1, t2, t3; arena_t m; init_arena(&m); for (t1=0; t1<n; t1++) { arena_push(&m); for (t2=0; t2<n; t2++) { for (t3=0; t3<n; t3++) { show_label(t1); if (t1 != t2) show_label(t2); if (t1 != t3 && t2 != t3) show_label(t3); test_or3(&m, pos_occ(t1), pos_occ(t2), pos_occ(t3)); printf("\n"); } } arena_pop(&m); } delete_arena(&m); }