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.

52 lines
1.8KB

  1. #ifndef COMMIT_SLAB_H
  2. #define COMMIT_SLAB_H
  3. #include "commit-slab-decl.h"
  4. #include "commit-slab-impl.h"
  5. /*
  6. * define_commit_slab(slabname, elemtype) creates boilerplate code to define
  7. * a new struct (struct slabname) that is used to associate a piece of data
  8. * of elemtype to commits, and a few functions to use that struct.
  9. *
  10. * After including this header file, using:
  11. *
  12. * define_commit_slab(indegree, int);
  13. *
  14. * will let you call the following functions:
  15. *
  16. * - int *indegree_at(struct indegree *, struct commit *);
  17. *
  18. * This function locates the data associated with the given commit in
  19. * the indegree slab, and returns the pointer to it. The location to
  20. * store the data is allocated as necessary.
  21. *
  22. * - int *indegree_peek(struct indegree *, struct commit *);
  23. *
  24. * This function is similar to indegree_at(), but it will return NULL
  25. * until a call to indegree_at() was made for the commit.
  26. *
  27. * - void init_indegree(struct indegree *);
  28. * void init_indegree_with_stride(struct indegree *, int);
  29. *
  30. * Initializes the indegree slab that associates an array of integers
  31. * to each commit. 'stride' specifies how big each array is. The slab
  32. * that is initialized by the variant without "_with_stride" associates
  33. * each commit with an array of one integer.
  34. *
  35. * - void clear_indegree(struct indegree *);
  36. *
  37. * Empties the slab. The slab can be reused with the same stride
  38. * without calling init_indegree() again or can be reconfigured to a
  39. * different stride by calling init_indegree_with_stride().
  40. *
  41. * Call this function before the slab falls out of scope to avoid
  42. * leaking memory.
  43. */
  44. #define define_commit_slab(slabname, elemtype) \
  45. declare_commit_slab(slabname, elemtype); \
  46. implement_static_commit_slab(slabname, elemtype)
  47. #endif /* COMMIT_SLAB_H */