[Bf-blender-cvs] [10e2b771214] master: Cleanup: makesrna, Clang-tidy else-after-return-fixes.
Ankit Meel
noreply at git.blender.org
Tue Oct 20 21:40:14 CEST 2020
Commit: 10e2b771214af6d0e5589f267c6b1f10bfaea5f9
Author: Ankit Meel
Date: Tue Oct 20 22:23:59 2020 +0530
Branches: master
https://developer.blender.org/rB10e2b771214af6d0e5589f267c6b1f10bfaea5f9
Cleanup: makesrna, Clang-tidy else-after-return-fixes.
It got left out of {rBc04088fed1b8faea6b2928bb5e09ab3}.
No functional change.
===================================================================
M source/blender/makesrna/intern/makesrna.c
M source/blender/makesrna/intern/rna_access.c
M source/blender/makesrna/intern/rna_access_compare_override.c
M source/blender/makesrna/intern/rna_define.c
===================================================================
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index fa589597111..bd762bd5357 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -239,10 +239,8 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
if (cmp) {
REN_IF_DIFF;
}
- else {
- remove(tmpfile);
- return 0;
- }
+ remove(tmpfile);
+ return 0;
#undef REN_IF_DIFF
}
@@ -254,7 +252,7 @@ static const char *rna_safe_id(const char *id)
if (STREQ(id, "default")) {
return "default_value";
}
- else if (STREQ(id, "operator")) {
+ if (STREQ(id, "operator")) {
return "operator_value";
}
else if (STREQ(id, "new")) {
@@ -286,14 +284,14 @@ static int cmp_property(const void *a, const void *b)
if (STREQ(propa->identifier, "rna_type")) {
return -1;
}
- else if (STREQ(propb->identifier, "rna_type")) {
+ if (STREQ(propb->identifier, "rna_type")) {
return 1;
}
if (STREQ(propa->identifier, "name")) {
return -1;
}
- else if (STREQ(propb->identifier, "name")) {
+ if (STREQ(propb->identifier, "name")) {
return 1;
}
@@ -551,9 +549,7 @@ static const char *rna_parameter_type_name(PropertyRNA *parm)
if (parm->flag_parameter & PARM_RNAPTR) {
return "PointerRNA";
}
- else {
- return rna_find_dna_type((const char *)pparm->type);
- }
+ return rna_find_dna_type((const char *)pparm->type);
}
case PROP_COLLECTION: {
return "CollectionListBase";
@@ -2270,9 +2266,7 @@ static const char *rna_parameter_type_cpp_name(PropertyRNA *prop)
return (const char *)pprop->type;
}
- else {
- return rna_parameter_type_name(prop);
- }
+ return rna_parameter_type_name(prop);
}
static void rna_def_struct_function_prototype_cpp(FILE *f,
@@ -3206,9 +3200,7 @@ static const char *rna_property_subtypename(PropertySubType type)
if (RNA_SUBTYPE_UNIT(type)) {
return rna_property_subtypename(type & ~RNA_SUBTYPE_UNIT(type));
}
- else {
- return "PROP_SUBTYPE_UNKNOWN";
- }
+ return "PROP_SUBTYPE_UNKNOWN";
}
}
}
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 15a4a4e740e..a631fe4fc26 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -132,9 +132,7 @@ void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
if (type == idtype) {
break;
}
- else {
- idtype = type;
- }
+ idtype = type;
}
}
@@ -166,9 +164,7 @@ void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
if (rtype == r_ptr->type) {
break;
}
- else {
- r_ptr->type = rtype;
- }
+ r_ptr->type = rtype;
}
}
}
@@ -209,15 +205,11 @@ PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *da
if (type == result.type) {
break;
}
- else {
- result.type = type;
- }
+ result.type = type;
}
return result;
}
- else {
- return PointerRNA_NULL;
- }
+ return PointerRNA_NULL;
}
void RNA_pointer_recast(PointerRNA *ptr, PointerRNA *r_ptr)
@@ -399,14 +391,12 @@ IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
if (group->type == IDP_GROUP) {
return IDP_GetPropertyFromGroup(group, name);
}
- else {
- /* Not sure why that happens sometimes, with nested properties... */
- /* Seems to be actually array prop, name is usually "0"... To be sorted out later. */
+ /* Not sure why that happens sometimes, with nested properties... */
+ /* Seems to be actually array prop, name is usually "0"... To be sorted out later. */
#if 0
printf(
"Got unexpected IDProp container when trying to retrieve %s: %d\n", name, group->type);
#endif
- }
}
return NULL;
@@ -430,15 +420,13 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
int arraylen[RNA_MAX_ARRAY_DIMENSION];
return (prop->getlength && ptr->data) ? prop->getlength(ptr, arraylen) : prop->totarraylength;
}
- else {
- IDProperty *idprop = (IDProperty *)prop;
+ IDProperty *idprop = (IDProperty *)prop;
- if (idprop->type == IDP_ARRAY) {
- return idprop->len;
- }
- else {
- return 0;
- }
+ if (idprop->type == IDP_ARRAY) {
+ return idprop->len;
+ }
+ else {
+ return 0;
}
}
@@ -447,11 +435,9 @@ static bool rna_ensure_property_array_check(PropertyRNA *prop)
if (prop->magic == RNA_MAGIC) {
return (prop->getlength || prop->totarraylength);
}
- else {
- IDProperty *idprop = (IDProperty *)prop;
+ IDProperty *idprop = (IDProperty *)prop;
- return (idprop->type == IDP_ARRAY);
- }
+ return (idprop->type == IDP_ARRAY);
}
static void rna_ensure_property_multi_array_length(PointerRNA *ptr,
@@ -675,9 +661,7 @@ PropertyRNA *rna_ensure_property(PropertyRNA *prop)
if (idprop->type == IDP_ARRAY) {
return arraytypemap[(int)(idprop->subtype)];
}
- else {
- return typemap[(int)(idprop->type)];
- }
+ return typemap[(int)(idprop->type)];
}
}
@@ -686,9 +670,7 @@ static const char *rna_ensure_property_identifier(const PropertyRNA *prop)
if (prop->magic == RNA_MAGIC) {
return prop->identifier;
}
- else {
- return ((const IDProperty *)prop)->name;
- }
+ return ((const IDProperty *)prop)->name;
}
static const char *rna_ensure_property_description(const PropertyRNA *prop)
@@ -758,9 +740,7 @@ int RNA_struct_ui_icon(const StructRNA *type)
if (type) {
return type->icon;
}
- else {
- return ICON_DOT;
- }
+ return ICON_DOT;
}
const char *RNA_struct_ui_description(const StructRNA *type)
@@ -1107,9 +1087,7 @@ bool RNA_struct_available_or_report(ReportList *reports, const char *identifier)
MEM_freeN(result);
return false;
}
- else {
- return true;
- }
+ return true;
}
bool RNA_struct_bl_idname_ok_or_report(ReportList *reports,
@@ -1279,15 +1257,15 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index)
if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
return quatitem[index];
}
- else if ((index < 4) && ELEM(subtype,
- PROP_TRANSLATION,
- PROP_DIRECTION,
- PROP_XYZ,
- PROP_XYZ_LENGTH,
- PROP_EULER,
- PROP_VELOCITY,
- PROP_ACCELERATION,
- PROP_COORDS)) {
+ if ((index < 4) && ELEM(subtype,
+ PROP_TRANSLATION,
+ PROP_DIRECTION,
+ PROP_XYZ,
+ PROP_XYZ_LENGTH,
+ PROP_EULER,
+ PROP_VELOCITY,
+ PROP_ACCELERATION,
+ PROP_COORDS)) {
return vectoritem[index];
}
else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
@@ -1551,7 +1529,7 @@ int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value)
*value = min;
return -1;
}
- else if (*value > max) {
+ if (*value > max) {
*value = max;
return 1;
}
@@ -1570,7 +1548,7 @@ int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value)
*value = min;
return -1;
}
- else if (*value > max) {
+ if (*value > max) {
*value = max;
return 1;
}
@@ -1597,7 +1575,7 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
if (pprop->typef) {
return pprop->typef(ptr);
}
- else if (pprop->type) {
+ if (pprop->type) {
return pprop->type;
}
}
@@ -1624,9 +1602,7 @@ bool RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *v
if (rna_idproperty_check(&prop, ptr)) {
return ((PropPointerPollFuncPy)pprop->poll)(ptr, *value, prop);
}
- else {
- return pprop->poll(ptr, *value);
- }
+ return pprop->poll(ptr, *value);
}
return 1;
@@ -1859,9 +1835,7 @@ bool RNA_enum_identifier(const EnumPropertyItem *item, const int value, const ch
*r_identifier = item[i].identifier;
return true;
}
- else {
- return false;
- }
+ return false;
}
int RNA_enum_bitflag_identifiers(const EnumPropertyItem *item,
@@ -1885,9 +1859,7 @@ bool RNA_enum_name(const EnumPropertyItem *item, const int value, const char **r
*r_name = item[i].name;
return true;
}
- else {
- return false;
- }
+ return false;
}
bool RNA_enum_description(const EnumPropertyItem *item,
@@ -1899,9 +1871,7 @@ bool RNA_enum_description(const EnumPropertyItem *item,
*r_description = item[i].description;
return true;
}
- else {
- return false;
- }
+ return false;
}
int RNA_enum_from_identifier(const EnumPropertyItem *item, const char *identifier)
@@ -2620,16 +2590,14 @@ bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop,
RNA_property_boolean_get_default_array(ptr, prop, tmp);
return tmp[index];
}
- else {
- bool *tmparray, value;
+ bool *tmparray, value;
- tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
- RNA_property_boolean_get_default_array(ptr, prop, tmparray);
- value = tmparray[index];
- MEM_freeN(tmparray);
+ tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
+ RNA_property_boolean_get_default_array(ptr, prop, tmparray);
+ value = tmparray[index];
+ MEM_freeN(tmparray);
- return value;
- }
+ return value;
}
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
@@ -2643,7 +2611,7 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
if ((idprop = rna_idproperty_check(&prop, ptr))) {
return IDP_Int(idprop);
}
- else if (iprop->get) {
+ if (iprop->get) {
return iprop->get(ptr);
}
else if (iprop->get_ex) {
@@ -2800,16 +2768,14 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyR
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list