[MPlayer-cvslog] r37128 - trunk/libmenu/vf_menu.c

reimar subversion at mplayerhq.hu
Sun Apr 6 19:57:34 CEST 2014


Author: reimar
Date: Sun Apr  6 19:57:33 2014
New Revision: 37128

Log:
vf_menu: try to make code more straight-forward.

Modified:
   trunk/libmenu/vf_menu.c

Modified: trunk/libmenu/vf_menu.c
==============================================================================
--- trunk/libmenu/vf_menu.c	Sun Apr  6 19:56:13 2014	(r37127)
+++ trunk/libmenu/vf_menu.c	Sun Apr  6 19:57:33 2014	(r37128)
@@ -103,16 +103,14 @@ static int cmd_filter(mp_cmd_t* cmd, int
     return 1;
   }
   case MP_CMD_SET_MENU : {
-    char* menu = cmd->args[0].v.s;
-    menu_t* l = priv->current;
-    priv->current = menu_open(menu);
-    if(!priv->current) {
-      mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToOpenMenu,menu);
-      priv->current = l;
-      priv->current->show = 0;
+    const char *menu = cmd->args[0].v.s;
+    menu_t *new = menu_open(menu);
+    priv->current->show = new != NULL;
+    if (new) {
+      new->parent = priv->current;
+      priv->current = new;
     } else {
-      priv->current->show = 1;
-      priv->current->parent = l;
+      mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToOpenMenu,menu);
     }
     return 1;
   }


More information about the MPlayer-cvslog mailing list