changeset 32836:2af511e2575e

Do proper and portable initialization.
author ib
date Thu, 17 Feb 2011 15:06:37 +0000
parents 19cc523b8e15
children 0501ab77f5e2
files gui/skin/font.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gui/skin/font.c	Thu Feb 17 13:35:58 2011 +0000
+++ b/gui/skin/font.c	Thu Feb 17 15:06:37 2011 +0000
@@ -27,19 +27,21 @@
 #include "../interface.h"
 #include "libavutil/avstring.h"
 
-bmpFont * Fonts[MAX_FONTS] = {NULL};
+bmpFont * Fonts[MAX_FONTS] = {0};
 
 int fntAddNewFont( char * name )
 {
  int id, i;
+ bmpFont init = {0};
 
  for( id=0;id<MAX_FONTS;id++ )
    if ( !Fonts[id] ) break;
 
  if ( id == MAX_FONTS ) return -2;
 
- if ( ( Fonts[id]=calloc( 1,sizeof( bmpFont ) ) ) == NULL ) return -1;
+ if ( ( Fonts[id]=malloc( sizeof( bmpFont ) ) ) == NULL ) return -1;
 
+ *Fonts[id] = init;
  av_strlcpy( Fonts[id]->name,name,MAX_FONT_NAME );
  for ( i=0;i<ASCII_CHRS+EXTRA_CHRS;i++ )
    Fonts[id]->Fnt[i].x=Fonts[id]->Fnt[i].y=Fonts[id]->Fnt[i].sx=Fonts[id]->Fnt[i].sy=-1;