changeset 32944:27a98940e3aa

Use FF_ARRAY_ELEMS() rather than a separate constant.
author ib
date Sun, 06 Mar 2011 11:55:52 +0000
parents d1c2c8899ec1
children 15aecb36f23e
files gui/app.c gui/skin/skin.c
diffstat 2 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gui/app.c	Sat Mar 05 14:25:37 2011 +0000
+++ b/gui/app.c	Sun Mar 06 11:55:52 2011 +0000
@@ -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 @@
     { evSetAspect,         "evSetAspect"         }
 };
 
-static const int EVENTS = sizeof(evNames) / sizeof(evName);
-
 static void appClearItem(wItem *item)
 {
     item->type   = itNone;
@@ -143,9 +143,9 @@
 
 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;
 
--- a/gui/skin/skin.c	Sat Mar 05 14:25:37 2011 +0000
+++ b/gui/skin/skin.c	Sun Mar 06 11:55:52 2011 +0000
@@ -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 @@
     { "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 @@
     unsigned char *ptmp;
     unsigned char command[32];
     unsigned char param[256];
-    int i;
+    unsigned int i;
 
     fn = setname(skinDirInHome, dname);
 
@@ -907,7 +906,7 @@
         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;