[MPlayer-cvslog] r37179 - in trunk/gui: app/cfg.c dialog/playlist.c dialog/url.c interface.c ui/main.c util/list.c

ib subversion at mplayerhq.hu
Sat Apr 26 18:32:53 CEST 2014


Author: ib
Date: Sat Apr 26 18:32:53 2014
New Revision: 37179

Log:
Determine size from variable declaration.

Modified:
   trunk/gui/app/cfg.c
   trunk/gui/dialog/playlist.c
   trunk/gui/dialog/url.c
   trunk/gui/interface.c
   trunk/gui/ui/main.c
   trunk/gui/util/list.c

Modified: trunk/gui/app/cfg.c
==============================================================================
--- trunk/gui/app/cfg.c	Sat Apr 26 18:30:54 2014	(r37178)
+++ trunk/gui/app/cfg.c	Sat Apr 26 18:32:53 2014	(r37179)
@@ -294,7 +294,7 @@ void cfg_read(void)
             if (!*line)
                 continue;
 
-            item = calloc(1, sizeof(plItem));
+            item = calloc(1, sizeof(*item));
 
             if (!item) {
                 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
@@ -329,7 +329,7 @@ void cfg_read(void)
             if (!*line)
                 continue;
 
-            item = calloc(1, sizeof(urlItem));
+            item = calloc(1, sizeof(*item));
 
             if (!item) {
                 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);

Modified: trunk/gui/dialog/playlist.c
==============================================================================
--- trunk/gui/dialog/playlist.c	Sat Apr 26 18:30:54 2014	(r37178)
+++ trunk/gui/dialog/playlist.c	Sat Apr 26 18:32:53 2014	(r37179)
@@ -143,7 +143,7 @@ static void plButtonReleased( GtkButton 
         for ( i=0;i<NrOfSelected;i++ )
          {
           char * text[2];
-          item=calloc( 1,sizeof( plItem ) );
+          item=calloc( 1,sizeof( *item ) );
           gtk_clist_get_text( GTK_CLIST( CLSelected ),i,2,&text[0] );
           gtk_clist_get_text( GTK_CLIST( CLSelected ),i,3,&text[1] );
           item->name = strdup( text[0] );
@@ -361,7 +361,7 @@ static void plCTree( GtkCTree * ctree,Gt
 
        if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' )
         {
-         DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=False; DirNode->path=strdup( path );
+         DirNode=malloc( sizeof( *DirNode ) ); DirNode->scaned=False; DirNode->path=strdup( path );
          subdir=check_for_subdir( path );
          node=gtk_ctree_insert_node( ctree,parent_node,NULL,&utf8name,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE );
          gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL );
@@ -479,7 +479,7 @@ static GtkWidget * CreatePlaylist( void 
   if ( !pxClosedBook ) pxClosedBook=gdk_pixmap_create_from_xpm_d( Playlist->window,&msClosedBook,&transparent,(gchar **)open2_xpm );
 
   parent=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),NULL,NULL,&root,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,FALSE,FALSE );
-  DirNode=malloc( sizeof( DirNodeType ) );
+  DirNode=malloc( sizeof( *DirNode ) );
   DirNode->scaned=False; DirNode->path=strdup( root );
   gtk_ctree_node_set_row_data_full(GTK_CTREE( CTDirTree ),parent,DirNode,NULL );
   sibling=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),parent,NULL,&dummy,4,NULL,NULL,NULL,NULL,TRUE,TRUE );

Modified: trunk/gui/dialog/url.c
==============================================================================
--- trunk/gui/dialog/url.c	Sat Apr 26 18:30:54 2014	(r37178)
+++ trunk/gui/dialog/url.c	Sat Apr 26 18:32:53 2014	(r37179)
@@ -74,7 +74,7 @@ static void button_clicked(GtkButton *bu
                 listMgr(PLAYLIST_DELETE, 0);
                 add_to_gui_playlist(str, PLAYLIST_ITEM_APPEND);
 
-                item = calloc(1, sizeof(urlItem));
+                item = calloc(1, sizeof(*item));
 
                 if (item) {
                     item->url = str;

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Sat Apr 26 18:30:54 2014	(r37178)
+++ trunk/gui/interface.c	Sat Apr 26 18:32:53 2014	(r37179)
@@ -108,7 +108,7 @@ static void add_vf(const char *vf, const
             listFree(&vf_settings[i].attribs);
             vf_settings[i].attribs = listDup(argvf);
         } else {
-            void *settings = realloc(vf_settings, (i + 2) * sizeof(m_obj_settings_t));
+            void *settings = realloc(vf_settings, (i + 2) * sizeof(*vf_settings));
 
             if (!settings)
                 return;
@@ -119,7 +119,7 @@ static void add_vf(const char *vf, const
             memset(&vf_settings[i + 1], 0, sizeof(m_obj_settings_t));
         }
     } else {
-        vf_settings = calloc(2, sizeof(m_obj_settings_t));
+        vf_settings = calloc(2, sizeof(*vf_settings));
 
         if (!vf_settings)
             return;

Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c	Sat Apr 26 18:30:54 2014	(r37178)
+++ trunk/gui/ui/main.c	Sat Apr 26 18:32:53 2014	(r37179)
@@ -353,7 +353,7 @@ static void uiMainDND(int num,char** fil
         listMgr(PLAYLIST_DELETE,0);
       }
 
-      item = calloc(1,sizeof(plItem));
+      item = calloc(1,sizeof(*item));
 
       s = strrchr( str,'/' );
 

Modified: trunk/gui/util/list.c
==============================================================================
--- trunk/gui/util/list.c	Sat Apr 26 18:30:54 2014	(r37178)
+++ trunk/gui/util/list.c	Sat Apr 26 18:32:53 2014	(r37179)
@@ -407,7 +407,7 @@ int add_to_gui_playlist(const char *what
     else
         strcpy(path, ".");
 
-    item = calloc(1, sizeof(plItem));
+    item = calloc(1, sizeof(*item));
 
     if (!item) {
         free(path);


More information about the MPlayer-cvslog mailing list