changeset 32839:2dd39155f320

Cosmetic: Make conditions more readable by having assignments outside.
author ib
date Fri, 18 Feb 2011 20:16:36 +0000
parents 95465a2dec73
children 904d9843ffb6
files gui/skin/font.c
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/gui/skin/font.c	Fri Feb 18 10:38:39 2011 +0000
+++ b/gui/skin/font.c	Fri Feb 18 20:16:36 2011 +0000
@@ -38,7 +38,9 @@
 
  if ( id == MAX_FONTS ) return -2;
 
- if ( !( Fonts[id]=calloc( 1,sizeof( *Fonts[id] ) ) ) ) return -1;
+ Fonts[id]=calloc( 1,sizeof( *Fonts[id] ) );
+
+ if ( !Fonts[id] ) return -1;
 
  av_strlcpy( Fonts[id]->name,name,MAX_FONT_NAME );
  for ( i=0;i<ASCII_CHRS+EXTRA_CHRS;i++ )
@@ -69,11 +71,16 @@
  unsigned char   param[256];
  int             id, n;
 
- if ( ( id = fntAddNewFont( fname ) ) < 0 ) return id;
+ id = fntAddNewFont( fname );
+
+ if ( id < 0 ) return id;
 
  av_strlcpy( tmp,path,sizeof( tmp ) );
  av_strlcat( tmp,fname,sizeof( tmp ) ); av_strlcat( tmp,".fnt",sizeof( tmp ) );
- if ( !( f=fopen( tmp,"rt" ) ) )
+
+ f=fopen( tmp,"rt" );
+
+ if ( !f )
   {
    gfree( (void **) &Fonts[id] );
    return -3;
@@ -85,7 +92,8 @@
    tmp[strcspn(tmp, "\n\r")] = 0;
    strswap( tmp,'\t',' ' );
    trim( tmp );
-   if ((ptmp = strchr(tmp, ';')) && !(ptmp == tmp + 1 && tmp[0] == '"' && tmp[2] == '"')) *ptmp = '\0';
+   ptmp = strchr(tmp, ';');
+   if (ptmp && !(ptmp == tmp + 1 && tmp[0] == '"' && tmp[2] == '"')) *ptmp = '\0';
    if (!*tmp) continue;
    n = (strncmp(tmp, "\"=", 2) == 0 ? 1 : 0);
    cutItem( tmp,command,'=',n ); cutItem( tmp,param,'=',n+1 );