git-2.22.0/t/helper/test-lazy-init-name-hash.c
/*
 * Dump the contents of the "dir" and "name" hash tables to stdout.
 * If you sort the result, you can compare it with the other type
 * mode and verify that both single and multi produce the same set.
 */
Dump the contents of the "dir" and "name" hash tables to stdout.
If you sort the result, you can compare it with the other type
mode and verify that both single and multi produce the same set.
Dump the contents of the " dir " and " name " hash tables to stdout . If you sort the result you can compare it with the other type mode and verify that both single and multi produce the same set .
static void dump_run(void)
{
	struct hashmap_iter iter_dir;
	struct hashmap_iter iter_cache;
	struct dir_entry {
		struct hashmap_entry ent;
		struct dir_entry *parent;
		int nr;
		unsigned int namelen;
		char name[FLEX_ARRAY];
	};
	struct dir_entry *dir;
	struct cache_entry *ce;
	read_cache();
	if (single) {
		test_lazy_init_name_hash(&the_index, 0);
	} else {
		int nr_threads_used = test_lazy_init_name_hash(&the_index, 1);
		if (!nr_threads_used)
			die("non-threaded code path used");
	}
	dir = hashmap_iter_first(&the_index.dir_hash, &iter_dir);
	while (dir) {
		printf("dir %08x %7d %s\n", dir->ent.hash, dir->nr, dir->name);
		dir = hashmap_iter_next(&iter_dir);
	}
	ce = hashmap_iter_first(&the_index.name_hash, &iter_cache);
	while (ce) {
		printf("name %08x %s\n", ce->ent.hash, ce->name);
		ce = hashmap_iter_next(&iter_cache);
	}
	discard_cache();
}
static void dump_run ( void ) { struct hashmap_iter iter_dir ; struct hashmap_iter iter_cache ; struct dir_entry { struct hashmap_entry ent ; struct dir_entry * parent ; int nr ; unsigned int namelen ; char name [ FLEX_ARRAY ] ; } ; struct dir_entry * dir ; struct cache_entry * ce ; read_cache ( ) ; if ( single ) { test_lazy_init_name_hash ( & the_index , 0 ) ; } else { int nr_threads_used = test_lazy_init_name_hash ( & the_index , 1 ) ; if ( ! nr_threads_used ) die ( " " ) ; } dir = hashmap_iter_first ( & the_index . dir_hash , & iter_dir ) ; while ( dir ) { printf ( " \n " , dir -> ent . hash , dir -> nr , dir -> name ) ; dir = hashmap_iter_next ( & iter_dir ) ; } ce = hashmap_iter_first ( & the_index . name_hash , & iter_cache ) ; while ( ce ) { printf ( " \n " , ce -> ent . hash , ce -> name ) ; ce = hashmap_iter_next ( & iter_cache ) ; } discard_cache ( ) ; }
Dump the contents of the "dir" and "name" hash tables to stdout.
Dump the contents of the " dir " and " name " hash tables to stdout .
/* Stolen from name-hash.c */