MCPcopy Index your code
hub / github.com/git/git / alloc_test_entry

Function alloc_test_entry

t/unit-tests/u-hashmap.c:35–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35static struct test_entry *alloc_test_entry(const char *key, const char *value,
36 unsigned int ignore_case)
37{
38 size_t klen = strlen(key);
39 size_t vlen = strlen(value);
40 unsigned int hash = ignore_case ? strihash(key) : strhash(key);
41 struct test_entry *entry = xmalloc(st_add4(sizeof(*entry), klen, vlen, 2));
42
43 hashmap_entry_init(&entry->ent, hash);
44 memcpy(entry->key, key, klen + 1);
45 memcpy(entry->key + klen + 1, value, vlen + 1);
46 return entry;
47}
48
49static struct test_entry *get_test_entry(struct hashmap *map, const char *key,
50 unsigned int ignore_case)

Callers 6

t_replaceFunction · 0.70
t_getFunction · 0.70
t_addFunction · 0.70
t_removeFunction · 0.70
t_iterateFunction · 0.70
t_allocFunction · 0.70

Calls 4

strihashFunction · 0.85
strhashFunction · 0.85
hashmap_entry_initFunction · 0.85
xmallocFunction · 0.50

Tested by

no test coverage detected