diff options
author | Ankit Meel <ankitjmeel@gmail.com> | 2020-11-07 15:54:56 +0300 |
---|---|---|
committer | Ankit Meel <ankitjmeel@gmail.com> | 2020-11-07 16:18:13 +0300 |
commit | ae342ed4511cf2e144dcd27ce2c635d3d536f9ad (patch) | |
tree | 02901841a7625c85bee5e8eb1fa1796d1b6136b4 /source/blender | |
parent | 4525049aa0cf818f6483dce589ac9791eb562338 (diff) |
Cleanup: Clang-tidy else-after-return
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 74 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access_compare_override.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 23 |
4 files changed, 43 insertions, 60 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 5aa684539af..8b861d20e4e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -256,10 +256,10 @@ static const char *rna_safe_id(const char *id) if (STREQ(id, "operator")) { return "operator_value"; } - else if (STREQ(id, "new")) { + if (STREQ(id, "new")) { return "create"; } - else if (STREQ(id, "co_return")) { + if (STREQ(id, "co_return")) { /* MSVC2015, C++ uses for coroutines */ return "coord_return"; } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a631fe4fc26..361168bcf3f 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -425,9 +425,7 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop) if (idprop->type == IDP_ARRAY) { return idprop->len; } - else { - return 0; - } + return 0; } static bool rna_ensure_property_array_check(PropertyRNA *prop) @@ -1268,7 +1266,7 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index) PROP_COORDS)) { return vectoritem[index]; } - else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) { + if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) { return coloritem[index]; } @@ -1533,9 +1531,7 @@ int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value) *value = max; return 1; } - else { - return 0; - } + return 0; } int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value) @@ -1552,9 +1548,7 @@ int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value) *value = max; return 1; } - else { - return 0; - } + return 0; } /* this is the max length including \0 terminator. @@ -2614,7 +2608,7 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop) if (iprop->get) { return iprop->get(ptr); } - else if (iprop->get_ex) { + if (iprop->get_ex) { return iprop->get_ex(ptr, prop); } else { @@ -2950,7 +2944,7 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop) } return (float)IDP_Double(idprop); } - else if (fprop->get) { + if (fprop->get) { return fprop->get(ptr); } else if (fprop->get_ex) { @@ -3389,7 +3383,7 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop) #endif return idprop->len - 1; } - else if (sprop->length) { + if (sprop->length) { return sprop->length(ptr); } else if (sprop->length_ex) { @@ -3555,7 +3549,7 @@ int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop) if (eprop->get) { return eprop->get(ptr); } - else if (eprop->get_ex) { + if (eprop->get_ex) { return eprop->get_ex(ptr, prop); } else { @@ -3671,7 +3665,7 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop) } return rna_pointer_inherit_refine(ptr, pprop->type, idprop); } - else if (pprop->get) { + if (pprop->get) { return pprop->get(ptr); } else if (prop->flag & PROP_IDPROPERTY) { @@ -3924,18 +3918,16 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop) if (cprop->length) { return cprop->length(ptr); } - else { - CollectionPropertyIterator iter; - int length = 0; - - RNA_property_collection_begin(ptr, prop, &iter); - for (; iter.valid; RNA_property_collection_next(&iter)) { - length++; - } - RNA_property_collection_end(&iter); + CollectionPropertyIterator iter; + int length = 0; - return length; + RNA_property_collection_begin(ptr, prop, &iter); + for (; iter.valid; RNA_property_collection_next(&iter)) { + length++; } + RNA_property_collection_end(&iter); + + return length; } /* This helper checks whether given collection property itself is editable (we only currently @@ -5775,21 +5767,19 @@ static char *rna_idp_path(PointerRNA *ptr, path = rna_idp_path_create(&link); break; } - else { - int j; - link.name = iter->name; - for (j = 0; j < iter->len; j++, array++) { - PointerRNA child_ptr; - if (RNA_property_collection_lookup_int(ptr, prop, j, &child_ptr)) { - link.index = j; - if ((path = rna_idp_path(&child_ptr, array, needle, &link))) { - break; - } + int j; + link.name = iter->name; + for (j = 0; j < iter->len; j++, array++) { + PointerRNA child_ptr; + if (RNA_property_collection_lookup_int(ptr, prop, j, &child_ptr)) { + link.index = j; + if ((path = rna_idp_path(&child_ptr, array, needle, &link))) { + break; } } - if (path) { - break; - } + } + if (path) { + break; } } } @@ -6788,9 +6778,7 @@ static char *rna_pointer_as_string__bldata(Main *bmain, PointerRNA *ptr) if (RNA_struct_is_ID(ptr->type)) { return RNA_path_full_ID_py(bmain, ptr->owner_id); } - else { - return RNA_path_full_struct_py(bmain, ptr); - } + return RNA_path_full_struct_py(bmain, ptr); } char *RNA_pointer_as_string(bContext *C, @@ -6805,9 +6793,7 @@ char *RNA_pointer_as_string(bContext *C, if ((prop = rna_idproperty_check(&prop_ptr, ptr)) && prop->type != IDP_ID) { return RNA_pointer_as_string_id(C, ptr_prop); } - else { - return rna_pointer_as_string__bldata(CTX_data_main(C), ptr_prop); - } + return rna_pointer_as_string__bldata(CTX_data_main(C), ptr_prop); } /* context can be NULL */ diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c index d367bc663f1..4bbbf5f01da 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.c +++ b/source/blender/makesrna/intern/rna_access_compare_override.c @@ -211,7 +211,7 @@ bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACo if (ptr_a == NULL || ptr_b == NULL) { return false; } - else if (ptr_a->type != ptr_b->type) { + if (ptr_a->type != ptr_b->type) { return false; } diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index b298d49fad5..b437e60ecf9 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -513,7 +513,7 @@ static int rna_find_sdna_member(SDNA *sdna, return 1; } - else if (cmp == 3) { + if (cmp == 3) { smember->type = ""; smember->name = dnaname; smember->offset = *offset; @@ -2199,15 +2199,13 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, dp->dnaoffset = smember.offset; return dp; } - else { - CLOG_ERROR(&LOG, - "\"%s.%s\" (identifier \"%s\") not found. Struct must be in DNA.", - structname, - propname, - prop->identifier); - DefRNA.error = true; - return NULL; - } + CLOG_ERROR(&LOG, + "\"%s.%s\" (identifier \"%s\") not found. Struct must be in DNA.", + structname, + propname, + prop->identifier); + DefRNA.error = true; + return NULL; } if (smember.arraylength > 1) { @@ -4363,9 +4361,8 @@ int rna_parameter_size(PropertyRNA *parm) } return sizeof(PointerRNA *); } - else { - return sizeof(void *); - } + return sizeof(void *); + #endif } case PROP_COLLECTION: |