changeset 32929:6ea9e024f05e

Clean up appInitStruct(). There is no need to memset or set a variable to zero after it has already been erased. Additionally, rearrange statements to meet order in structure.
author ib
date Thu, 03 Mar 2011 14:09:50 +0000
parents 0ef78cd3063b
children b52831437104
files gui/app.c
diffstat 1 files changed, 12 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/gui/app.c	Thu Mar 03 13:58:48 2011 +0000
+++ b/gui/app.c	Thu Mar 03 14:09:50 2011 +0000
@@ -120,6 +120,18 @@
 {
     int i;
 
+    appClearItem(&appMPlayer.main);
+    appMPlayer.mainDecoration = 0;
+
+    appClearItem(&appMPlayer.sub);
+
+    appClearItem(&appMPlayer.bar);
+    appMPlayer.barIsPresent = 0;
+
+    appClearItem(&appMPlayer.menuBase);
+    appClearItem(&appMPlayer.menuSelected);
+    appMPlayer.menuIsPresent = 0;
+
     for (i = 0; i < appMPlayer.NumberOfMainItems + 1; i++)
         appClearItem(&appMPlayer.mainItems[i]);
     for (i = 0; i < appMPlayer.NumberOfBarItems + 1; i++)
@@ -127,29 +139,6 @@
     for (i = 0; i < appMPlayer.NumberOfMenuItems + 1; i++)
         appClearItem(&appMPlayer.menuItems[i]);
 
-    memset(appMPlayer.mainItems, 0, 256 * sizeof(wItem));
-
-    memset(appMPlayer.menuItems, 0, 64 * sizeof(wItem));
-
-    memset(appMPlayer.barItems, 0, 256 * sizeof(wItem));
-
-    appClearItem(&appMPlayer.main);
-    appMPlayer.mainDecoration = 0;
-
-    appClearItem(&appMPlayer.sub);
-    appMPlayer.sub.width  = 0;
-    appMPlayer.sub.height = 0;
-
-    appClearItem(&appMPlayer.bar);
-    appClearItem(&appMPlayer.menuBase);
-    appClearItem(&appMPlayer.menuSelected);
-
-    appMPlayer.sub.R         = appMPlayer.sub.G = appMPlayer.sub.B = 0;
-    appMPlayer.bar.R         = appMPlayer.bar.G = appMPlayer.bar.B = 0;
-    appMPlayer.main.R        = appMPlayer.main.G = appMPlayer.main.B = 0;
-    appMPlayer.barIsPresent  = 0;
-    appMPlayer.menuIsPresent = 0;
-
     appResetStruct();
 }