fix windows VC9 build
Move variable declarations to the top of the functions.
This commit is contained in:
parent
872f4dbd6d
commit
c4a1e2ac00
@ -55,6 +55,9 @@ static int diff_hunk_cb(
|
||||
{
|
||||
PyObject *hunks;
|
||||
Hunk *hunk;
|
||||
int len;
|
||||
char* old_path, *new_path;
|
||||
|
||||
|
||||
hunks = PyDict_GetItemString(cb_data, "hunks");
|
||||
if (hunks == NULL) {
|
||||
@ -71,9 +74,6 @@ static int diff_hunk_cb(
|
||||
hunk->new_start = range->new_start;
|
||||
hunk->new_lines = range->new_lines;
|
||||
|
||||
int len;
|
||||
char* old_path, *new_path;
|
||||
|
||||
if (delta->old_file.path != NULL) {
|
||||
len = strlen(delta->old_file.path) + 1;
|
||||
old_path = malloc(sizeof(char) * len);
|
||||
|
@ -4,6 +4,7 @@ PyObject *GitError;
|
||||
|
||||
PyObject * Error_type(int type)
|
||||
{
|
||||
const git_error* error;
|
||||
// Expected
|
||||
switch (type) {
|
||||
/** Input does not exist in the scope searched. */
|
||||
@ -32,7 +33,7 @@ PyObject * Error_type(int type)
|
||||
}
|
||||
|
||||
// Critical
|
||||
const git_error* error = giterr_last();
|
||||
error = giterr_last();
|
||||
if(error != NULL) {
|
||||
switch (error->klass) {
|
||||
case GITERR_NOMEMORY:
|
||||
@ -66,13 +67,14 @@ PyObject* Error_set(int err)
|
||||
|
||||
PyObject* Error_set_str(int err, const char *str)
|
||||
{
|
||||
const git_error* error;
|
||||
if (err == GIT_ENOTFOUND) {
|
||||
/* KeyError expects the arg to be the missing key. */
|
||||
PyErr_SetString(PyExc_KeyError, str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const git_error* error = giterr_last();
|
||||
error = giterr_last();
|
||||
return PyErr_Format(Error_type(err), "%s: %s", str, error->message);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user