void print_dependents(char *name, int all) { struct pkglist *p = NULL; p = get_dependents(name, all); while (p != NULL) { if (strcmp(p->repo, "not found") != 0) { printf("%s\n", p->name); } p = p->next; } }
static void print_dep_table(dep_table_t *table) { int32_t *v; uint32_t i, n; printf("dep table %p\n", table); printf(" size = %"PRIu32"\n", table->size); printf(" nelems = %"PRIu32"\n", table->nelems); printf(" content:\n"); n = table->nelems; for (i=0; i<n; i++) { v = get_dependents(table, i); if (v != NULL) { printf(" dep[%"PRId32"] = {", i); print_vector(v); printf(" }\n"); } } printf("\n"); }
/* * n random additions to table */ static void test_additions(dep_table_t *table, uint32_t n) { int32_t i, j; int32_t *v; while (n > 0) { i = (int32_t) (random() & 255); j = (int32_t) (random() & 255); printf("test add %"PRId32" to dep[%"PRId32"]: ", j, i); add_dependent(table, i, j); // check that j is the last element of dep[i]; v = get_dependents(table, i); if (v == NULL) { printf("BUG: empty vector\n"); exit(1); } if (index_vector_last(v) != j) { printf("BUG: addition failed\n"); exit(1); } printf("ok\n"); n --; } }