changeset 37083:ae4f30c4ef02

Determine size from variable declaration.
author ib
date Sat, 26 Apr 2014 16:32:53 +0000
parents 9e3b2b71a146
children e1453cdb2bed
files gui/app/cfg.c gui/dialog/playlist.c gui/dialog/url.c gui/interface.c gui/ui/main.c gui/util/list.c
diffstat 6 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/gui/app/cfg.c	Sat Apr 26 16:30:54 2014 +0000
+++ b/gui/app/cfg.c	Sat Apr 26 16:32:53 2014 +0000
@@ -294,7 +294,7 @@
             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 @@
             if (!*line)
                 continue;
 
-            item = calloc(1, sizeof(urlItem));
+            item = calloc(1, sizeof(*item));
 
             if (!item) {
                 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
--- a/gui/dialog/playlist.c	Sat Apr 26 16:30:54 2014 +0000
+++ b/gui/dialog/playlist.c	Sat Apr 26 16:32:53 2014 +0000
@@ -143,7 +143,7 @@
         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 @@
 
        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 @@
   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 );
--- a/gui/dialog/url.c	Sat Apr 26 16:30:54 2014 +0000
+++ b/gui/dialog/url.c	Sat Apr 26 16:32:53 2014 +0000
@@ -74,7 +74,7 @@
                 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;
--- a/gui/interface.c	Sat Apr 26 16:30:54 2014 +0000
+++ b/gui/interface.c	Sat Apr 26 16:32:53 2014 +0000
@@ -108,7 +108,7 @@
             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 @@
             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;
--- a/gui/ui/main.c	Sat Apr 26 16:30:54 2014 +0000
+++ b/gui/ui/main.c	Sat Apr 26 16:32:53 2014 +0000
@@ -353,7 +353,7 @@
         listMgr(PLAYLIST_DELETE,0);
       }
 
-      item = calloc(1,sizeof(plItem));
+      item = calloc(1,sizeof(*item));
 
       s = strrchr( str,'/' );
 
--- a/gui/util/list.c	Sat Apr 26 16:30:54 2014 +0000
+++ b/gui/util/list.c	Sat Apr 26 16:32:53 2014 +0000
@@ -407,7 +407,7 @@
     else
         strcpy(path, ".");
 
-    item = calloc(1, sizeof(plItem));
+    item = calloc(1, sizeof(*item));
 
     if (!item) {
         free(path);