[MPlayer-cvslog] r33031 - in trunk/gui: app.c skin/skin.c

ib subversion at mplayerhq.hu
Sun Mar 6 12:55:53 CET 2011


Author: ib
Date: Sun Mar  6 12:55:52 2011
New Revision: 33031

Log:
Use FF_ARRAY_ELEMS() rather than a separate constant.

Modified:
   trunk/gui/app.c
   trunk/gui/skin/skin.c

Modified: trunk/gui/app.c
==============================================================================
--- trunk/gui/app.c	Sat Mar  5 15:25:37 2011	(r33030)
+++ trunk/gui/app.c	Sun Mar  6 12:55:52 2011	(r33031)
@@ -21,6 +21,8 @@
 #include "gui/skin/font.h"
 #include "interface.h"
 
+#include "libavutil/common.h"
+
 guiItems appMPlayer;
 
 static const evName evNames[] = {
@@ -74,8 +76,6 @@ static const evName evNames[] = {
     { evSetAspect,         "evSetAspect"         }
 };
 
-static const int EVENTS = sizeof(evNames) / sizeof(evName);
-
 static void appClearItem(wItem *item)
 {
     item->type   = itNone;
@@ -143,9 +143,9 @@ void appFreeStruct(void)
 
 int appFindMessage(unsigned char *str)
 {
-    int i;
+    unsigned int i;
 
-    for (i = 0; i < EVENTS; i++)
+    for (i = 0; i < FF_ARRAY_ELEMS(evNames); i++)
         if (!strcmp(evNames[i].name, str))
             return evNames[i].message;
 

Modified: trunk/gui/skin/skin.c
==============================================================================
--- trunk/gui/skin/skin.c	Sat Mar  5 15:25:37 2011	(r33030)
+++ trunk/gui/skin/skin.c	Sun Mar  6 12:55:52 2011	(r33031)
@@ -28,6 +28,7 @@
 #include "config.h"
 #include "help_mp.h"
 #include "libavutil/avstring.h"
+#include "libavutil/common.h"
 #include "mp_msg.h"
 
 typedef struct {
@@ -809,8 +810,6 @@ static _item skinItem[] = {
     { "menu",       cmd_menu       }
 };
 
-static const int ITEMS = sizeof(skinItem) / sizeof(_item);
-
 char *strswap(char *in, char what, char whereof)
 {
     int i;
@@ -870,7 +869,7 @@ int skinRead(char *dname)
     unsigned char *ptmp;
     unsigned char command[32];
     unsigned char param[256];
-    int i;
+    unsigned int i;
 
     fn = setname(skinDirInHome, dname);
 
@@ -907,7 +906,7 @@ int skinRead(char *dname)
         cutItem(tmp, param, '=', 1);
         strlower(command);
 
-        for (i = 0; i < ITEMS; i++)
+        for (i = 0; i < FF_ARRAY_ELEMS(skinItem); i++)
             if (!strcmp(command, skinItem[i].name))
                 if (skinItem[i].func(param) != 0)
                     return -2;


More information about the MPlayer-cvslog mailing list