From f26d6bedfec7bf0eca746c3a4381b66c85fe2322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= Date: Sun, 24 Nov 2013 11:49:17 +0100 Subject: [PATCH] C coding style: indentation fixes --- src/diff.c | 4 ++-- src/note.c | 6 +++--- src/remote.c | 4 ++-- src/repository.c | 39 ++++++++++++++++++++------------------- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/diff.c b/src/diff.c index 01e6e7d..f81f635 100644 --- a/src/diff.c +++ b/src/diff.c @@ -71,7 +71,7 @@ diff_get_patch_byindex(git_diff* diff, size_t idx) PyObject *py_line_origin=NULL, *py_line=NULL; err = git_patch_from_diff(&patch, diff, idx); - if (err < 0) + if (err < 0) return Error_set(err); delta = git_patch_get_delta(patch); @@ -110,7 +110,7 @@ diff_get_patch_byindex(git_diff* diff, size_t idx) err = git_patch_get_line_in_hunk(&line, patch, i, j); if (err < 0) - goto cleanup; + goto cleanup; py_line_origin = to_unicode_n(&line->origin, 1, NULL, NULL); py_line = to_unicode_n(line->content, line->content_len, NULL, NULL); diff --git a/src/note.c b/src/note.c index c7ef0f2..c515d8b 100644 --- a/src/note.c +++ b/src/note.c @@ -72,7 +72,7 @@ PyDoc_STRVAR(Note_oid__doc__, PyObject * Note_oid__get__(Note *self) { - return git_oid_to_python(git_note_oid(self->note)); + return git_oid_to_python(git_note_oid(self->note)); } @@ -82,7 +82,7 @@ PyDoc_STRVAR(Note_message__doc__, PyObject * Note_message__get__(Note *self) { - return to_unicode(git_note_message(self->note), NULL, NULL); + return to_unicode(git_note_message(self->note), NULL, NULL); } @@ -207,7 +207,7 @@ PyTypeObject NoteIterType = { 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ - (iternextfunc) NoteIter_iternext, /* tp_iternext */ + (iternextfunc) NoteIter_iternext, /* tp_iternext */ }; diff --git a/src/remote.c b/src/remote.c index 6b684ec..66530ce 100644 --- a/src/remote.c +++ b/src/remote.c @@ -86,7 +86,7 @@ Remote_name__set__(Remote *self, PyObject* py_name) free(name); if (err == GIT_OK) - return 0; + return 0; Error_set(err); } @@ -116,7 +116,7 @@ Remote_url__set__(Remote *self, PyObject* py_url) free(url); if (err == GIT_OK) - return 0; + return 0; Error_set(err); } diff --git a/src/repository.c b/src/repository.c index f682bcb..9663999 100644 --- a/src/repository.c +++ b/src/repository.c @@ -945,37 +945,37 @@ Repository_listall_branches(Repository *self, PyObject *args) list = PyList_New(0); if (list == NULL) - return NULL; + return NULL; if ((err = git_branch_iterator_new(&iter, self->repo, list_flags)) < 0) - return Error_set(err); + return Error_set(err); while ((err = git_branch_next(&ref, &type, iter)) == 0) { PyObject *py_branch_name = to_path(git_reference_shorthand(ref)); git_reference_free(ref); if (py_branch_name == NULL) - goto on_error; + goto error; err = PyList_Append(list, py_branch_name); Py_DECREF(py_branch_name); if (err < 0) - goto on_error; + goto error; } git_branch_iterator_free(iter); if (err == GIT_ITEROVER) - err = 0; + err = 0; if (err < 0) { Py_CLEAR(list); - return Error_set(err); + return Error_set(err); } return list; - on_error: +error: git_branch_iterator_free(iter); Py_CLEAR(list); return NULL; @@ -1116,26 +1116,27 @@ Repository_status(Repository *self, PyObject *args) entry = git_status_byindex(list, i); if (entry == NULL) - goto on_error; + goto error; /* We need to choose one of the strings */ - path = entry->head_to_index ? - entry->head_to_index->old_file.path : - entry->index_to_workdir->old_file.path; + if (entry->head_to_index) + path = entry->head_to_index->old_file.path; + else + path = entry->index_to_workdir->old_file.path; status = PyLong_FromLong((long) entry->status); err = PyDict_SetItemString(dict, path, status); Py_CLEAR(status); if (err < 0) - goto on_error; + goto error; } git_status_list_free(list); return dict; - on_error: +error: git_status_list_free(list); Py_CLEAR(dict); return NULL; @@ -1486,14 +1487,14 @@ PyObject* Repository_blame(Repository *self, PyObject *args, PyObject *kwds) return NULL; if (value1) { - err = py_oid_to_git_oid_expand(self->repo, value1, &opts.newest_commit); - if (err < 0) - return NULL; + err = py_oid_to_git_oid_expand(self->repo, value1, &opts.newest_commit); + if (err < 0) + return NULL; } if (value2) { - err = py_oid_to_git_oid_expand(self->repo, value2, &opts.oldest_commit); - if (err < 0) - return NULL; + err = py_oid_to_git_oid_expand(self->repo, value2, &opts.oldest_commit); + if (err < 0) + return NULL; } err = git_blame_file(&blame, self->repo, path, NULL);