diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-20 04:08:42 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-20 04:08:42 +0400 |
commit | cde0230a9858ba2c25b886840fbcd076508cb728 (patch) | |
tree | eb5c507ef7b4eb13887efbbed44a3e53a2f4810f /source/blender/blenkernel/intern/linestyle.c | |
parent | e1ce7f3f85377b922df2c50d12bbc89d0b7b4f74 (diff) |
Removed goto's as suggested first by Bastien Montagne and also by Sergey Sharybin
through a code review of the branch.
Diffstat (limited to 'source/blender/blenkernel/intern/linestyle.c')
-rw-r--r-- | source/blender/blenkernel/intern/linestyle.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 67f1d02024a..3b02e705d46 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -1011,36 +1011,35 @@ void FRS_list_modifier_color_ramps(FreestyleLineStyle *linestyle, ListBase *list } } -/* XXX Do we want to keep that goto? Or use a boolean var? */ char *FRS_path_from_ID_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *color_ramp) { LineStyleModifier *m; + bool found = false; for (m = (LineStyleModifier *)linestyle->color_modifiers.first; m; m = m->next) { switch (m->type) { case LS_MODIFIER_ALONG_STROKE: if (color_ramp == ((LineStyleColorModifier_AlongStroke *)m)->color_ramp) - goto found; + found = true; break; case LS_MODIFIER_DISTANCE_FROM_CAMERA: if (color_ramp == ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp) - goto found; + found = true; break; case LS_MODIFIER_DISTANCE_FROM_OBJECT: if (color_ramp == ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp) - goto found; + found = true; break; case LS_MODIFIER_MATERIAL: if (color_ramp == ((LineStyleColorModifier_Material *)m)->color_ramp) - goto found; + found = true; break; } + if (found) + return BLI_sprintfN("color_modifiers[\"%s\"].color_ramp", m->name); } printf("FRS_path_from_ID_to_color_ramp: No color ramps correspond to the given pointer.\n"); return NULL; - -found: - return BLI_sprintfN("color_modifiers[\"%s\"].color_ramp", m->name); } void FRS_unlink_linestyle_target_object(FreestyleLineStyle *linestyle, struct Object *ob) |