Make some Object methods take a const parameter Signed-off-by: Vicent Marti <tanoku@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
diff --git a/src/git2/object.h b/src/git2/object.h
index 084d111..128c9fa 100644
--- a/src/git2/object.h
+++ b/src/git2/object.h
@@ -66,7 +66,7 @@ GIT_EXTERN(int) git_object_write(git_object *object);
* @param obj the repository object
* @return the SHA1 id
*/
-GIT_EXTERN(const git_oid *) git_object_id(git_object *obj);
+GIT_EXTERN(const git_oid *) git_object_id(const git_object *obj);
/**
* Get the object type of an object
@@ -74,7 +74,7 @@ GIT_EXTERN(const git_oid *) git_object_id(git_object *obj);
* @param obj the repository object
* @return the object's type
*/
-GIT_EXTERN(git_otype) git_object_type(git_object *obj);
+GIT_EXTERN(git_otype) git_object_type(const git_object *obj);
/**
* Get the repository that owns this object
@@ -82,7 +82,7 @@ GIT_EXTERN(git_otype) git_object_type(git_object *obj);
* @param obj the object
* @return the repository who owns this object
*/
-GIT_EXTERN(git_repository *) git_object_owner(git_object *obj);
+GIT_EXTERN(git_repository *) git_object_owner(const git_object *obj);
/**
* Free a reference to one of the objects in the repository.
diff --git a/src/object.c b/src/object.c
index dd84cb5..c53a3ac 100644
--- a/src/object.c
+++ b/src/object.c
@@ -283,7 +283,7 @@ void git_object_free(git_object *object)
}
}
-const git_oid *git_object_id(git_object *obj)
+const git_oid *git_object_id(const git_object *obj)
{
assert(obj);
@@ -293,13 +293,13 @@ const git_oid *git_object_id(git_object *obj)
return &obj->id;
}
-git_otype git_object_type(git_object *obj)
+git_otype git_object_type(const git_object *obj)
{
assert(obj);
return obj->source.raw.type;
}
-git_repository *git_object_owner(git_object *obj)
+git_repository *git_object_owner(const git_object *obj)
{
assert(obj);
return obj->repo;