]> git.sesse.net Git - vlc/blob - src/misc/action.c
Don't print a message a malloc failed.
[vlc] / src / misc / action.c
1 /*****************************************************************************
2  * action.c: key to action mapping
3  *****************************************************************************
4  * Copyright © 2008 Rémi Denis-Courmont
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 #endif
24
25 #include <vlc_common.h>
26 #include "../libvlc.h"
27
28 int vlc_key_to_action (vlc_object_t *libvlc, const char *varname,
29                        vlc_value_t prevkey, vlc_value_t curkey, void *priv)
30 {
31     const struct hotkey *key = priv;
32
33     (void)varname;
34     (void)prevkey;
35
36     while (key->i_key != curkey.i_int)
37     {
38         if (key->psz_action == NULL)
39             return VLC_SUCCESS; /* key is not mapped to anything */
40
41         key++;
42     }
43
44     return var_SetInteger (libvlc, "key-action", key->i_action);
45 }
46