Commit aa2f68d8 by Vicent Martí

Merge pull request #378 from kiryl/Wuninitialized

Wuninitialized
parents 420cbdc2 c75a890b
...@@ -46,8 +46,13 @@ typedef SSIZE_T ssize_t; ...@@ -46,8 +46,13 @@ typedef SSIZE_T ssize_t;
#include "thread-utils.h" #include "thread-utils.h"
#include "bswap.h" #include "bswap.h"
extern int git__throw(int error, const char *, ...) GIT_FORMAT_PRINTF(2, 3); extern void git___throw(const char *, ...) GIT_FORMAT_PRINTF(1, 2);
extern int git__rethrow(int error, const char *, ...) GIT_FORMAT_PRINTF(2, 3); #define git__throw(error, ...) \
(git___throw(__VA_ARGS__), error)
extern void git___rethrow(const char *, ...) GIT_FORMAT_PRINTF(1, 2);
#define git__rethrow(error, ...) \
(git___rethrow(__VA_ARGS__), error)
#include "util.h" #include "util.h"
......
...@@ -77,7 +77,7 @@ const char *git_strerror(int num) ...@@ -77,7 +77,7 @@ const char *git_strerror(int num)
return "Unknown error"; return "Unknown error";
} }
int git__rethrow(int error, const char *msg, ...) void git___rethrow(const char *msg, ...)
{ {
char new_error[1024]; char new_error[1024];
char *old_error = NULL; char *old_error = NULL;
...@@ -91,19 +91,15 @@ int git__rethrow(int error, const char *msg, ...) ...@@ -91,19 +91,15 @@ int git__rethrow(int error, const char *msg, ...)
old_error = strdup(g_last_error); old_error = strdup(g_last_error);
snprintf(g_last_error, sizeof(g_last_error), "%s \n - %s", new_error, old_error); snprintf(g_last_error, sizeof(g_last_error), "%s \n - %s", new_error, old_error);
free(old_error); free(old_error);
return error;
} }
int git__throw(int error, const char *msg, ...) void git___throw(const char *msg, ...)
{ {
va_list va; va_list va;
va_start(va, msg); va_start(va, msg);
vsnprintf(g_last_error, sizeof(g_last_error), msg, va); vsnprintf(g_last_error, sizeof(g_last_error), msg, va);
va_end(va); va_end(va);
return error;
} }
const char *git_lasterror(void) const char *git_lasterror(void)
......
...@@ -151,6 +151,8 @@ static int do_connect(transport_git *t, const char *url) ...@@ -151,6 +151,8 @@ static int do_connect(transport_git *t, const char *url)
url += strlen(prefix); url += strlen(prefix);
error = extract_host_and_port(&host, &port, url); error = extract_host_and_port(&host, &port, url);
if (error < GIT_SUCCESS)
return error;
s = gitno_connect(host, port); s = gitno_connect(host, port);
connected = 1; connected = 1;
error = send_request(s, NULL, url); error = send_request(s, NULL, url);
......
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