Slight style improvements. Two rules of thumb that are almost always
good to apply: * Don't write a == CONST. Instead, write CONST == a. Or, more generally (in C like languages): Avoid putting an lvalue on the left-hand side of an == comparison. (For consistancy, I try to avoid lvalues on the left- hand side of any comparison---but == is the most notorious.) (An "lvalue" is a value that can safely go on the left side of an "=" assignment, of course. (^&) * Do not write if( !condition ) return; other_thing; return; (See page 18 of K&P's _The Elements of Programming Style_.) Instead, it is better to just write: if( condition ) other_thing; return; There are times when sacrificing structured programming (e.g., via multiple return statements) is okay. But, here, there is no apparent gain---indeed, there seems only loss---in the non-structured code. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@308 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
974e38bfbd
commit
aeeabeff93
@ -115,19 +115,14 @@ void FGAPIENTRY glutTimerFunc( unsigned int timeOut, void (* callback)( int ),
|
|||||||
*/
|
*/
|
||||||
static void fghVisibility( int status )
|
static void fghVisibility( int status )
|
||||||
{
|
{
|
||||||
FGCBVisibility vis;
|
int glut_status = GLUT_VISIBLE;
|
||||||
int glut_status;
|
|
||||||
|
|
||||||
freeglut_assert_ready;
|
freeglut_assert_ready;
|
||||||
freeglut_return_if_fail( fgStructure.Window );
|
freeglut_return_if_fail( fgStructure.Window );
|
||||||
vis = FETCH_WCB( ( *( fgStructure.Window ) ), Visibility );
|
|
||||||
freeglut_return_if_fail( vis );
|
|
||||||
|
|
||||||
if( status == GLUT_HIDDEN || status == GLUT_FULLY_COVERED )
|
if( ( GLUT_HIDDEN == status ) || ( GLUT_FULLY_COVERED == status ) )
|
||||||
glut_status = GLUT_NOT_VISIBLE;
|
glut_status = GLUT_NOT_VISIBLE;
|
||||||
else
|
INVOKE_WCB( *( fgStructure.Window ), Visibility, ( glut_status ) );
|
||||||
glut_status = GLUT_VISIBLE;
|
|
||||||
vis( glut_status );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) )
|
void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) )
|
||||||
@ -232,9 +227,8 @@ void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) )
|
|||||||
/* A. Donev: Destruction callback for menus */
|
/* A. Donev: Destruction callback for menus */
|
||||||
void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) )
|
void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) )
|
||||||
{
|
{
|
||||||
if( fgStructure.Menu == NULL )
|
if( fgStructure.Menu )
|
||||||
return;
|
fgStructure.Menu->Destroy = callback;
|
||||||
fgStructure.Menu->Destroy = callback;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user