mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
402fa75eed
commit
a59b276e18
18
decorate.h
Normal file
18
decorate.h
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user