Commit cfc2ae68 by yuangli

eliminate build warnings

parent 83f71b12
...@@ -501,8 +501,10 @@ int git_commit__parse_raw(void *commit, const char *data, size_t size) ...@@ -501,8 +501,10 @@ int git_commit__parse_raw(void *commit, const char *data, size_t size)
int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned int flags) int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned int flags)
{ {
git_repository *repo = git_object_owner((git_object *)commit);
git_commit_graft *graft;
int error; int error;
if ((error = commit_parse(commit, git_odb_object_data(odb_obj), if ((error = commit_parse(commit, git_odb_object_data(odb_obj),
git_odb_object_size(odb_obj), flags)) < 0) git_odb_object_size(odb_obj), flags)) < 0)
return error; return error;
...@@ -510,9 +512,6 @@ int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned ...@@ -510,9 +512,6 @@ int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned
if (!git_shallow__enabled) if (!git_shallow__enabled)
return 0; return 0;
git_repository *repo = git_object_owner((git_object *)commit);
git_commit_graft *graft;
/* Perform necessary grafts */ /* Perform necessary grafts */
if (git_grafts_get(&graft, repo->grafts, git_odb_object_id(odb_obj)) == 0 || if (git_grafts_get(&graft, repo->grafts, git_odb_object_id(odb_obj)) == 0 ||
git_grafts_get(&graft, repo->shallow_grafts, git_odb_object_id(odb_obj)) == 0) { git_grafts_get(&graft, repo->shallow_grafts, git_odb_object_id(odb_obj)) == 0) {
......
...@@ -85,7 +85,7 @@ void git_grafts_clear(git_grafts *grafts) ...@@ -85,7 +85,7 @@ void git_grafts_clear(git_grafts *grafts)
int git_grafts_refresh(git_grafts *grafts) int git_grafts_refresh(git_grafts *grafts)
{ {
git_buf contents = GIT_BUF_INIT; git_str contents = GIT_STR_INIT;
int error, updated = 0; int error, updated = 0;
assert(grafts); assert(grafts);
...@@ -94,7 +94,7 @@ int git_grafts_refresh(git_grafts *grafts) ...@@ -94,7 +94,7 @@ int git_grafts_refresh(git_grafts *grafts)
return 0; return 0;
error = git_futils_readbuffer_updated(&contents, grafts->path, error = git_futils_readbuffer_updated(&contents, grafts->path,
&grafts->path_checksum, &updated); (grafts->path_checksum).id, &updated);
if (error < 0 || error == GIT_ENOTFOUND || !updated) { if (error < 0 || error == GIT_ENOTFOUND || !updated) {
if (error == GIT_ENOTFOUND) { if (error == GIT_ENOTFOUND) {
git_grafts_clear(grafts); git_grafts_clear(grafts);
...@@ -107,7 +107,7 @@ int git_grafts_refresh(git_grafts *grafts) ...@@ -107,7 +107,7 @@ int git_grafts_refresh(git_grafts *grafts)
goto cleanup; goto cleanup;
cleanup: cleanup:
git_buf_dispose(&contents); git_str_dispose(&contents);
return error; return error;
} }
......
...@@ -413,6 +413,8 @@ int git_libgit2_opts(int key, ...) ...@@ -413,6 +413,8 @@ int git_libgit2_opts(int key, ...)
case GIT_OPT_SET_OWNER_VALIDATION: case GIT_OPT_SET_OWNER_VALIDATION:
git_repository__validate_ownership = (va_arg(ap, int) != 0); git_repository__validate_ownership = (va_arg(ap, int) != 0);
break;
case GIT_OPT_ENABLE_SHALLOW: case GIT_OPT_ENABLE_SHALLOW:
git_shallow__enabled = (va_arg(ap, int) != 0); git_shallow__enabled = (va_arg(ap, int) != 0);
break; break;
......
...@@ -732,10 +732,10 @@ out: ...@@ -732,10 +732,10 @@ out:
static int load_grafts(git_repository *repo) static int load_grafts(git_repository *repo)
{ {
git_buf path = GIT_BUF_INIT; git_str path = GIT_STR_INIT;
int error; int error;
if ((error = git_repository_item_path(&path, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 || if ((error = git_repository__item_path(&path, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 ||
(error = git_str_joinpath(&path, path.ptr, "grafts")) < 0 || (error = git_str_joinpath(&path, path.ptr, "grafts")) < 0 ||
(error = git_grafts_from_file(&repo->grafts, path.ptr)) < 0) (error = git_grafts_from_file(&repo->grafts, path.ptr)) < 0)
goto error; goto error;
...@@ -747,7 +747,7 @@ static int load_grafts(git_repository *repo) ...@@ -747,7 +747,7 @@ static int load_grafts(git_repository *repo)
goto error; goto error;
error: error:
git_buf_dispose(&path); git_str_dispose(&path);
return error; return error;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment