| 13 | } |
| 14 | |
| 15 | static void *insert_decoration(struct decoration *n, const struct object *base, void *decoration) |
| 16 | { |
| 17 | struct decoration_entry *entries = n->entries; |
| 18 | unsigned int j = hash_obj(base, n->size); |
| 19 | |
| 20 | while (entries[j].base) { |
| 21 | if (entries[j].base == base) { |
| 22 | void *old = entries[j].decoration; |
| 23 | entries[j].decoration = decoration; |
| 24 | return old; |
| 25 | } |
| 26 | if (++j >= n->size) |
| 27 | j = 0; |
| 28 | } |
| 29 | entries[j].base = base; |
| 30 | entries[j].decoration = decoration; |
| 31 | n->nr++; |
| 32 | return NULL; |
| 33 | } |
| 34 | |
| 35 | static void grow_decoration(struct decoration *n) |
| 36 | { |
no test coverage detected