diff options
author | Martin Koegler <mkoegler@auto.tuwien.ac.at> | 2008-02-25 22:46:04 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-25 23:57:34 -0800 |
commit | 355885d531568e144ce5c9a2f65792a3aa8b5528 (patch) | |
tree | a450dbd70c50ade7811d90981526dc9c4849871d /fsck.h | |
parent | f73df331a43a6092af427fd30bb6ce07f313743c (diff) | |
download | git-355885d531568e144ce5c9a2f65792a3aa8b5528.tar.gz |
add generic, type aware object chain walker
The requirements are:
* it may not crash on NULL pointers
* a callback function is needed, as index-pack/unpack-objects
need to do different things
* the type information is needed to check the expected <-> real type
and print better error messages
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fsck.h')
-rw-r--r-- | fsck.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fsck.h b/fsck.h new file mode 100644 index 0000000000..ba5514a818 --- /dev/null +++ b/fsck.h @@ -0,0 +1,23 @@ +#ifndef GIT_FSCK_H +#define GIT_FSCK_H + +/* + * callback function for fsck_walk + * type is the expected type of the object or OBJ_ANY + * the return value is: + * 0 everything OK + * <0 error signaled and abort + * >0 error signaled and do not abort + */ +typedef int (*fsck_walk_func)(struct object *obj, int type, void *data); + +/* descend in all linked child objects + * the return value is: + * -1 error in processing the object + * <0 return value of the callback, which lead to an abort + * >0 return value of the first sigaled error >0 (in the case of no other errors) + * 0 everything OK + */ +int fsck_walk(struct object *obj, fsck_walk_func walk, void *data); + +#endif |