THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.4KB

  1. #ifndef DECORATE_H
  2. #define DECORATE_H
  3. /*
  4. * A data structure that associates Git objects to void pointers. See
  5. * t/helper/test-example-decorate.c for a demonstration of how to use these
  6. * functions.
  7. */
  8. /*
  9. * An entry in the data structure.
  10. */
  11. struct decoration_entry {
  12. const struct object *base;
  13. void *decoration;
  14. };
  15. /*
  16. * The data structure.
  17. *
  18. * This data structure must be zero-initialized.
  19. */
  20. struct decoration {
  21. /*
  22. * Not used by the decoration mechanism. Clients may use this for
  23. * whatever they want.
  24. */
  25. const char *name;
  26. /*
  27. * The capacity of "entries".
  28. */
  29. unsigned int size;
  30. /*
  31. * The number of real Git objects (that is, entries with non-NULL
  32. * "base").
  33. */
  34. unsigned int nr;
  35. /*
  36. * The entries. This is an array of size "size", containing nr entries
  37. * with non-NULL "base" and (size - nr) entries with NULL "base".
  38. */
  39. struct decoration_entry *entries;
  40. };
  41. /*
  42. * Add an association from the given object to the given pointer (which may be
  43. * NULL), returning the previously associated pointer. If there is no previous
  44. * association, this function returns NULL.
  45. */
  46. void *add_decoration(struct decoration *n, const struct object *obj, void *decoration);
  47. /*
  48. * Return the pointer associated to the given object. If there is no
  49. * association, this function returns NULL.
  50. */
  51. void *lookup_decoration(struct decoration *n, const struct object *obj);
  52. #endif