Unverified Commit 175c6fb0 by Edward Thomson Committed by GitHub

Merge pull request #6659 from boretrk/fixwarn

util: suppress some uninitialized variable warnings
parents aea6eaf8 bde119e7
...@@ -376,6 +376,9 @@ void git_error_system_set(int code) ...@@ -376,6 +376,9 @@ void git_error_system_set(int code)
/* Deprecated error values and functions */ /* Deprecated error values and functions */
#ifndef GIT_DEPRECATE_HARD #ifndef GIT_DEPRECATE_HARD
#include "git2/deprecated.h"
const git_error *giterr_last(void) const git_error *giterr_last(void)
{ {
return git_error_last(); return git_error_last();
......
...@@ -1938,12 +1938,13 @@ static int sudo_uid_lookup(uid_t *out) ...@@ -1938,12 +1938,13 @@ static int sudo_uid_lookup(uid_t *out)
{ {
git_str uid_str = GIT_STR_INIT; git_str uid_str = GIT_STR_INIT;
int64_t uid; int64_t uid;
int error; int error = -1;
if ((error = git__getenv(&uid_str, "SUDO_UID")) == 0 && if (git__getenv(&uid_str, "SUDO_UID") == 0 &&
(error = git__strntol64(&uid, uid_str.ptr, uid_str.size, NULL, 10)) == 0 && git__strntol64(&uid, uid_str.ptr, uid_str.size, NULL, 10) == 0 &&
uid == (int64_t)((uid_t)uid)) { uid == (int64_t)((uid_t)uid)) {
*out = (uid_t)uid; *out = (uid_t)uid;
error = 0;
} }
git_str_dispose(&uid_str); git_str_dispose(&uid_str);
......
...@@ -25,7 +25,7 @@ extern int git_futils_readbuffer(git_str *obj, const char *path); ...@@ -25,7 +25,7 @@ extern int git_futils_readbuffer(git_str *obj, const char *path);
extern int git_futils_readbuffer_updated( extern int git_futils_readbuffer_updated(
git_str *obj, git_str *obj,
const char *path, const char *path,
unsigned char checksum[GIT_HASH_SHA1_SIZE], unsigned char checksum[GIT_HASH_SHA256_SIZE],
int *updated); int *updated);
extern int git_futils_readbuffer_fd_full(git_str *obj, git_file fd); extern int git_futils_readbuffer_fd_full(git_str *obj, git_file fd);
extern int git_futils_readbuffer_fd(git_str *obj, git_file fd, size_t len); extern int git_futils_readbuffer_fd(git_str *obj, git_file fd, size_t len);
......
...@@ -657,7 +657,7 @@ static bool has_at(const char *str) ...@@ -657,7 +657,7 @@ static bool has_at(const char *str)
int git_net_url_parse_scp(git_net_url *url, const char *given) int git_net_url_parse_scp(git_net_url *url, const char *given)
{ {
const char *default_port = default_port_for_scheme("ssh"); const char *default_port = default_port_for_scheme("ssh");
const char *c, *user, *host, *port, *path = NULL; const char *c, *user, *host, *port = NULL, *path = NULL;
size_t user_len = 0, host_len = 0, port_len = 0; size_t user_len = 0, host_len = 0, port_len = 0;
unsigned short bracket = 0; unsigned short bracket = 0;
......
...@@ -125,7 +125,7 @@ int git_regexp_search(const git_regexp *r, const char *string, size_t nmatches, ...@@ -125,7 +125,7 @@ int git_regexp_search(const git_regexp *r, const char *string, size_t nmatches,
if ((data = pcre2_match_data_create(nmatches, NULL)) == NULL) { if ((data = pcre2_match_data_create(nmatches, NULL)) == NULL) {
git_error_set_oom(); git_error_set_oom();
goto out; return -1;
} }
if ((error = pcre2_match(*r, (const unsigned char *) string, strlen(string), if ((error = pcre2_match(*r, (const unsigned char *) string, strlen(string),
......
...@@ -37,7 +37,7 @@ struct git_process { ...@@ -37,7 +37,7 @@ struct git_process {
GIT_INLINE(bool) is_delete_env(const char *env) GIT_INLINE(bool) is_delete_env(const char *env)
{ {
char *c = index(env, '='); char *c = strchr(env, '=');
if (c == NULL) if (c == NULL)
return false; return false;
......
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