summaryrefslogtreecommitdiff
path: root/decorate.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-04-16 16:03:15 -0700
committerJunio C Hamano <junkio@cox.net>2007-04-16 16:51:09 -0700
commita59b276e18f3d4a548caf549e05188cb1bd3a709 (patch)
tree2633d6fd7b33dddee9c1d7ed35d6061bffc957ba /decorate.h
parent402fa75eed29c104ae5392ce88560f6bffc64ce7 (diff)
downloadgit-a59b276e18f3d4a548caf549e05188cb1bd3a709.tar.gz
Add a generic "object decorator" interface, and make object refs use it
This allows you to add an arbitrary "decoration" of your choice to any object. It's a space- and time-efficient way to add information to arbitrary objects, especially if most objects probably do not have the decoration. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'decorate.h')
-rw-r--r--decorate.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/decorate.h b/decorate.h
new file mode 100644
index 0000000000..1fa4ad9beb
--- /dev/null
+++ b/decorate.h
@@ -0,0 +1,18 @@
+#ifndef DECORATE_H
+#define DECORATE_H
+
+struct object_decoration {
+ struct object *base;
+ void *decoration;
+};
+
+struct decoration {
+ const char *name;
+ unsigned int size, nr;
+ struct object_decoration *hash;
+};
+
+extern void *add_decoration(struct decoration *n, struct object *obj, void *decoration);
+extern void *lookup_decoration(struct decoration *n, struct object *obj);
+
+#endif