diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/commit.c | 26 | ||||
| -rw-r--r-- | src/commit.h | 8 | ||||
| -rw-r--r-- | src/git/commit.h | 11 | ||||
| -rw-r--r-- | src/git/common.h | 7 |
4 files changed, 26 insertions, 26 deletions
diff --git a/src/commit.c b/src/commit.c index e4e56117d..4199e8e9c 100644 --- a/src/commit.c +++ b/src/commit.c @@ -161,7 +161,7 @@ git_commit *git_commit_lookup(git_revpool *pool, const git_oid *id) return commit; } -int git_commit__parse_person(git_commit_person *person, char **buffer_out, +int git__parse_person(git_person *person, char **buffer_out, const char *buffer_end, const char *header) { const size_t header_len = strlen(header); @@ -220,7 +220,7 @@ int git_commit__parse_person(git_commit_person *person, char **buffer_out, return 0; } -int git_commit__parse_oid(git_oid *oid, char **buffer_out, +int git__parse_oid(git_oid *oid, char **buffer_out, const char *buffer_end, const char *header) { const size_t sha_len = GIT_OID_HEXSZ; @@ -251,9 +251,9 @@ int git_commit__parse_buffer(git_commit *commit, void *data, size_t len, unsigne const char *buffer_end = (char *)data + len; git_oid oid; - git_commit_person person; + git_person person; - if (git_commit__parse_oid(&oid, &buffer, buffer_end, "tree ") < 0) + if (git__parse_oid(&oid, &buffer, buffer_end, "tree ") < 0) return GIT_EOBJCORRUPTED; if (parse_flags & GIT_COMMIT_TREE) @@ -266,7 +266,7 @@ int git_commit__parse_buffer(git_commit *commit, void *data, size_t len, unsigne if (parse_flags & GIT_COMMIT_PARENTS) git_commit_list_clear(&commit->parents, 0); - while (git_commit__parse_oid(&oid, &buffer, buffer_end, "parent ") == 0) { + while (git__parse_oid(&oid, &buffer, buffer_end, "parent ") == 0) { git_commit *parent; if ((parse_flags & GIT_COMMIT_PARENTS) == 0) @@ -283,18 +283,18 @@ int git_commit__parse_buffer(git_commit *commit, void *data, size_t len, unsigne return GIT_ENOMEM; } - if (git_commit__parse_person(&person, &buffer, buffer_end, "author ") < 0) + if (git__parse_person(&person, &buffer, buffer_end, "author ") < 0) return GIT_EOBJCORRUPTED; if (parse_flags & GIT_COMMIT_AUTHOR) { if (commit->author) free(commit->author); - commit->author = git__malloc(sizeof(git_commit_person)); - memcpy(commit->author, &person, sizeof(git_commit_person)); + commit->author = git__malloc(sizeof(git_person)); + memcpy(commit->author, &person, sizeof(git_person)); } - if (git_commit__parse_person(&person, &buffer, buffer_end, "committer ") < 0) + if (git__parse_person(&person, &buffer, buffer_end, "committer ") < 0) return GIT_EOBJCORRUPTED; if (parse_flags & GIT_COMMIT_TIME) @@ -304,8 +304,8 @@ int git_commit__parse_buffer(git_commit *commit, void *data, size_t len, unsigne if (commit->committer) free(commit->committer); - commit->committer = git__malloc(sizeof(git_commit_person)); - memcpy(commit->committer, &person, sizeof(git_commit_person)); + commit->committer = git__malloc(sizeof(git_person)); + memcpy(commit->committer, &person, sizeof(git_person)); } /* parse commit message */ @@ -347,7 +347,7 @@ const git_tree *git_commit_tree(git_commit *commit) return commit->tree; } -const git_commit_person *git_commit_author(git_commit *commit) +const git_person *git_commit_author(git_commit *commit) { if (commit->author) return commit->author; @@ -356,7 +356,7 @@ const git_commit_person *git_commit_author(git_commit *commit) return commit->author; } -const git_commit_person *git_commit_committer(git_commit *commit) +const git_person *git_commit_committer(git_commit *commit) { if (commit->committer) return commit->committer; diff --git a/src/commit.h b/src/commit.h index 36fd65cf2..028c83712 100644 --- a/src/commit.h +++ b/src/commit.h @@ -40,8 +40,8 @@ struct git_commit { git_commit_list parents; git_tree *tree; - git_commit_person *author; - git_commit_person *committer; + git_person *author; + git_person *committer; char *message; char *message_short; @@ -58,11 +58,11 @@ struct git_commit { void git_commit__free(git_commit *c); int git_commit__parse(git_commit *commit, unsigned int flags, int close_odb); int git_commit__parse_basic(git_commit *commit); -int git_commit__parse_oid(git_oid *oid, char **buffer_out, const char *buffer_end, const char *header); int git_commit__parse_buffer(git_commit *commit, void *data, size_t len, unsigned int parse_flags); -int git_commit__parse_person(git_commit_person *person, char **buffer_out, const char *buffer_end, const char *header); void git_commit__mark_uninteresting(git_commit *commit); +int git__parse_oid(git_oid *oid, char **buffer_out, const char *buffer_end, const char *header); +int git__parse_person(git_person *person, char **buffer_out, const char *buffer_end, const char *header); int git_commit_list_push_back(git_commit_list *list, git_commit *commit); int git_commit_list_push_front(git_commit_list *list, git_commit *commit); diff --git a/src/git/commit.h b/src/git/commit.h index 6d34f01ce..89f0929c9 100644 --- a/src/git/commit.h +++ b/src/git/commit.h @@ -17,13 +17,6 @@ GIT_BEGIN_DECL /** Parsed representation of a commit object. */ typedef struct git_commit git_commit; -/** Parsed representation of an author/committer of a commit */ -typedef struct git_commit_person { - char name[64]; /**< Full name */ - char email[64]; /**< Email address */ - time_t time; /**< Time when this person commited the change */ -} git_commit_person; - /** * Locate a reference to a commit without loading it. * The generated commit object is owned by the revision @@ -84,14 +77,14 @@ GIT_EXTERN(time_t) git_commit_time(git_commit *commit); * @param commit a previously loaded commit. * @return the committer of a commit */ -GIT_EXTERN(const git_commit_person *) git_commit_committer(git_commit *commit); +GIT_EXTERN(const git_person *) git_commit_committer(git_commit *commit); /** * Get the author of a commit. * @param commit a previously loaded commit. * @return the author of a commit */ -GIT_EXTERN(const git_commit_person *) git_commit_author(git_commit *commit); +GIT_EXTERN(const git_person *) git_commit_author(git_commit *commit); /** * Get the tree pointed to by a commit. diff --git a/src/git/common.h b/src/git/common.h index 2506dae36..09972aade 100644 --- a/src/git/common.h +++ b/src/git/common.h @@ -88,6 +88,13 @@ GIT_BEGIN_DECL /** A revision traversal pool. */ typedef struct git_revpool git_revpool; +/** Parsed representation of a person */ +typedef struct git_person { + char name[64]; /**< Full name */ + char email[64]; /**< Email address */ + time_t time; /**< Time when this person commited the change */ +} git_person; + /** @} */ GIT_END_DECL #endif |
