[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55431] branches/soc-2008-mxcurioni/source /blender/blenkernel/intern/linestyle.c: Removed goto' s as suggested first by Bastien Montagne and also by Sergey Sharybin

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Wed Mar 20 01:08:44 CET 2013


Revision: 55431
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55431
Author:   kjym3
Date:     2013-03-20 00:08:42 +0000 (Wed, 20 Mar 2013)
Log Message:
-----------
Removed goto's as suggested first by Bastien Montagne and also by Sergey Sharybin
through a code review of the branch.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c	2013-03-19 23:54:14 UTC (rev 55430)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c	2013-03-20 00:08:42 UTC (rev 55431)
@@ -1011,36 +1011,35 @@
 	}
 }
 
-/* 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)




More information about the Bf-blender-cvs mailing list