summaryrefslogtreecommitdiff
path: root/src/remote.c
diff options
context:
space:
mode:
authorLeo Yang <lyang@topologyinc.com>2015-04-28 12:40:20 -0400
committerLeo Yang <lyang@topologyinc.com>2015-04-28 12:40:20 -0400
commit69f0032b4c9fb48df56cf4eca6e535f2618ed864 (patch)
tree9b3652146fa7a9afa67309ab8b3e6a03d1fd5799 /src/remote.c
parentd969d41547080d5e924d49f44ba5de1ade5b343c (diff)
downloadlibgit2-69f0032b4c9fb48df56cf4eca6e535f2618ed864.tar.gz
Fix some build warnings
In checkout.c and filter.c we were casting a sub struct to a parent struct which breaks the strict aliasing rules in C. However we can use .parent or .base to access the parent struct to avoid the build warnings. In remote.c the local variable error was not initialized or updated in some cases. For unintialized error a build warning will be generated. So always keep error variable up-to-date.
Diffstat (limited to 'src/remote.c')
-rw-r--r--src/remote.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/remote.c b/src/remote.c
index ac7c43c78..3f840b699 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -171,11 +171,11 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
if ((error = git_repository_config_snapshot(&config, repo)) < 0)
goto on_error;
- if (lookup_remote_prune_config(remote, config, name) < 0)
+ if ((error = lookup_remote_prune_config(remote, config, name)) < 0)
goto on_error;
/* Move the data over to where the matching functions can find them */
- if (dwim_refspecs(&remote->active_refspecs, &remote->refspecs, &remote->refs) < 0)
+ if ((error = dwim_refspecs(&remote->active_refspecs, &remote->refspecs, &remote->refs)) < 0)
goto on_error;
}
@@ -457,7 +457,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
goto cleanup;
/* Move the data over to where the matching functions can find them */
- if (dwim_refspecs(&remote->active_refspecs, &remote->refspecs, &remote->refs) < 0)
+ if ((error = dwim_refspecs(&remote->active_refspecs, &remote->refspecs, &remote->refs)) < 0)
goto cleanup;
*out = remote;
@@ -2330,7 +2330,7 @@ int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const gi
goto cleanup;
free_refspecs(&remote->active_refspecs);
- if (dwim_refspecs(&remote->active_refspecs, &remote->refspecs, &remote->refs) < 0)
+ if ((error = dwim_refspecs(&remote->active_refspecs, &remote->refspecs, &remote->refs)) < 0)
goto cleanup;
if (remote->push) {