Fix -Wclobbered warnings
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/137f7497 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/137f7497 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/137f7497 Branch: refs/heads/master Commit: 137f74977d7acc0d5314485eab1bdd537ffde71d Parents: 147e90e Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Thu Feb 8 13:54:07 2018 +0100 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Thu Feb 8 13:54:07 2018 +0100 ---------------------------------------------------------------------- compiler/src/CFCTestClass.c | 9 ++++----- compiler/src/CFCTestMethod.c | 9 ++++----- compiler/src/CFCTestSymbol.c | 7 +++---- compiler/src/CFCTestType.c | 7 +++---- compiler/src/CFCTestVariable.c | 7 +++---- 5 files changed, 17 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/137f7497/compiler/src/CFCTestClass.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTestClass.c b/compiler/src/CFCTestClass.c index e894bc0..524ad48 100644 --- a/compiler/src/CFCTestClass.c +++ b/compiler/src/CFCTestClass.c @@ -50,16 +50,15 @@ const CFCTestBatch CFCTEST_BATCH_CLASS = { static char* S_try_create(CFCParcel *parcel, const char *name, const char *nickname) { - CFCClass *klass = NULL; - char *error; + char *error; CFCUTIL_TRY { - klass = CFCClass_create(parcel, NULL, name, nickname, NULL, NULL, NULL, - false, false, false); + CFCClass *klass = CFCClass_create(parcel, NULL, name, nickname, NULL, + NULL, NULL, false, false, false); + CFCBase_decref((CFCBase*)klass); } CFCUTIL_CATCH(error); - CFCBase_decref((CFCBase*)klass); return error; } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/137f7497/compiler/src/CFCTestMethod.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTestMethod.c b/compiler/src/CFCTestMethod.c index c0cf67b..eebe1ed 100644 --- a/compiler/src/CFCTestMethod.c +++ b/compiler/src/CFCTestMethod.c @@ -65,16 +65,15 @@ S_run_tests(CFCTest *test) { static char* S_try_new_method(const char *name, CFCType *return_type, CFCParamList *param_list, CFCClass *klass) { - CFCMethod *method = NULL; - char *error; + char *error; CFCUTIL_TRY { - method = CFCMethod_new(NULL, name, return_type, param_list, NULL, - klass, 0, 0); + CFCMethod *method = CFCMethod_new(NULL, name, return_type, param_list, + NULL, klass, 0, 0); + CFCBase_decref((CFCBase*)method); } CFCUTIL_CATCH(error); - CFCBase_decref((CFCBase*)method); return error; } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/137f7497/compiler/src/CFCTestSymbol.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTestSymbol.c b/compiler/src/CFCTestSymbol.c index e21f847..4d14a3f 100644 --- a/compiler/src/CFCTestSymbol.c +++ b/compiler/src/CFCTestSymbol.c @@ -40,15 +40,14 @@ const CFCTestBatch CFCTEST_BATCH_SYMBOL = { static char* S_try_new_symbol(const char *name) { - CFCSymbol *symbol = NULL; - char *error; + char *error; CFCUTIL_TRY { - symbol = CFCSymbol_new("parcel", name); + CFCSymbol *symbol = CFCSymbol_new("parcel", name); + CFCBase_decref((CFCBase*)symbol); } CFCUTIL_CATCH(error); - CFCBase_decref((CFCBase*)symbol); return error; } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/137f7497/compiler/src/CFCTestType.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTestType.c b/compiler/src/CFCTestType.c index 9c77aaf..eee0dd8 100644 --- a/compiler/src/CFCTestType.c +++ b/compiler/src/CFCTestType.c @@ -264,15 +264,14 @@ S_run_void_tests(CFCTest *test) { static char* S_try_new_object(CFCParcel *parcel, const char *specifier, int indirection) { - CFCType *type = NULL; - char *error; + char *error; CFCUTIL_TRY { - type = CFCType_new_object(0, parcel, specifier, indirection); + CFCType *type = CFCType_new_object(0, parcel, specifier, indirection); + CFCBase_decref((CFCBase*)type); } CFCUTIL_CATCH(error); - CFCBase_decref((CFCBase*)type); return error; } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/137f7497/compiler/src/CFCTestVariable.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTestVariable.c b/compiler/src/CFCTestVariable.c index c088b85..c005a54 100644 --- a/compiler/src/CFCTestVariable.c +++ b/compiler/src/CFCTestVariable.c @@ -43,15 +43,14 @@ const CFCTestBatch CFCTEST_BATCH_VARIABLE = { static char* S_try_new_variable(const char *name, CFCType *type) { - CFCVariable *var = NULL; - char *error; + char *error; CFCUTIL_TRY { - var = CFCVariable_new(NULL, name, type, 0); + CFCVariable *var = CFCVariable_new(NULL, name, type, 0); + CFCBase_decref((CFCBase*)var); } CFCUTIL_CATCH(error); - CFCBase_decref((CFCBase*)var); return error; }