From 92b5fb9d59519cbc9f19247a2ab183f4aa924d64 Mon Sep 17 00:00:00 2001 From: rkrolib Date: Thu, 30 Oct 2003 04:43:08 +0000 Subject: [PATCH] Finished off most of the issues with freeglut_structure.c, from a stylistic point of view (at least, insofar as: The original file's code was INCON- SISTANT. I did not remove the "!= NULL" stuff, did not address the shortest-branch-first issue for if-else statements, and left some rather ugly "if (x) {... return y} /* else do this */ return NULL;" garbage. This should, I think, be re-written as "if (x) return y; else return NULL;" or even better, "ret = NULL; if (x) ret = y; return ret;" In short, the code still has some issues, but I think that it's a bit better. (Oh, I also got rid of oustanding TABs.) git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@271 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/freeglut_structure.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/freeglut/freeglut/src/freeglut_structure.c b/freeglut/freeglut/src/freeglut_structure.c index 353bb03..6ebd106 100644 --- a/freeglut/freeglut/src/freeglut_structure.c +++ b/freeglut/freeglut/src/freeglut_structure.c @@ -608,19 +608,12 @@ SFG_Menu* fgMenuByID( int menuID ) /* * It's enough to check all entries in fgStructure.Menus... */ - for( menu = (SFG_Menu *)fgStructure.Menus.First; menu; menu = (SFG_Menu *)menu->Node.Next ) - { - /* - * Does the ID number match? - */ + for( menu = (SFG_Menu *)fgStructure.Menus.First; + menu; + menu = (SFG_Menu *)menu->Node.Next ) if( menu->ID == menuID ) - return( menu ); - } - - /* - * We have not found the requested menu ID - */ - return( NULL ); + return menu; + return NULL; } /* @@ -673,7 +666,7 @@ int fgListLength(SFG_List *list) for( node = (SFG_Node *)list->First; node; node = (SFG_Node *)node->Next ) ++length; - return( length ); + return length; } /*** END OF FILE ***/