From d77611022c4a43d5e67cf52ce2bc2b11ee5bcdc0 Mon Sep 17 00:00:00 2001 From: Russell Belfer Date: Mon, 29 Apr 2013 14:22:06 -0700 Subject: Standardize cast versions of git_object accessors This removes the GIT_INLINE versions of the simple git_object accessors and standardizes them with a helper macro in src/object.h to build the function bodies. --- src/object.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/object.h') diff --git a/src/object.h b/src/object.h index d187c55b7..906d40736 100644 --- a/src/object.h +++ b/src/object.h @@ -28,4 +28,16 @@ int git_oid__parse(git_oid *oid, const char **buffer_out, const char *buffer_end void git_oid__writebuf(git_buf *buf, const char *header, const git_oid *oid); +#define GIT_OBJ_WRAPPER(TYPE,OBJTYPE) \ + int TYPE##_lookup(TYPE **out, git_repository *repo, const git_oid *id) { \ + return git_object_lookup((git_object **)out, repo, id, OBJTYPE); } \ + int TYPE##_lookup_prefix(TYPE **out, git_repository *repo, const git_oid *id, size_t len) { \ + return git_object_lookup_prefix((git_object **)out, repo, id, len, OBJTYPE); } \ + void TYPE##_free(TYPE *obj) { \ + git_object_free((git_object *)obj); } \ + const git_oid *TYPE##_id(const TYPE *obj) { \ + return git_object_id((const git_object *)obj); } \ + git_repository *TYPE##_owner(const TYPE *obj) { \ + return git_object_owner((const git_object *)obj); } + #endif -- cgit v1.2.1