5 * A data structure that associates Git objects to void pointers. See
6 * t/helper/test-example-decorate.c for a demonstration of how to use these
11 * An entry in the data structure.
13 struct decoration_entry
{
14 const struct object
*base
;
21 * This data structure must be zero-initialized.
25 * Not used by the decoration mechanism. Clients may use this for
31 * The capacity of "entries".
36 * The number of real Git objects (that is, entries with non-NULL
42 * The entries. This is an array of size "size", containing nr entries
43 * with non-NULL "base" and (size - nr) entries with NULL "base".
45 struct decoration_entry
*entries
;
49 * Add an association from the given object to the given pointer (which may be
50 * NULL), returning the previously associated pointer. If there is no previous
51 * association, this function returns NULL.
53 void *add_decoration(struct decoration
*n
, const struct object
*obj
, void *decoration
);
56 * Return the pointer associated to the given object. If there is no
57 * association, this function returns NULL.
59 void *lookup_decoration(struct decoration
*n
, const struct object
*obj
);
62 * Clear all decoration entries, releasing any memory used by the structure.
63 * If free_cb is not NULL, it is called for every decoration value currently
66 * After clearing, the decoration struct can be used again. The "name" field is
69 void clear_decoration(struct decoration
*n
, void (*free_cb
)(void *));