summaryrefslogtreecommitdiffstats
path: root/libmenu/menu.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-26 10:44:59 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-26 10:44:59 +0300
commitfb33e286b5c23dbe8d0aeaf63cd3490bed3906e3 (patch)
tree9e1eb90e7ec461afd59c3411c2be253b75a9f448 /libmenu/menu.c
parent6be229cbbfbe29ad61025051b1d903f5619e0b8a (diff)
downloadmpv-fb33e286b5c23dbe8d0aeaf63cd3490bed3906e3.tar.bz2
mpv-fb33e286b5c23dbe8d0aeaf63cd3490bed3906e3.tar.xz
Move global mconfig to mpctx
The global was used in the function cfg_include which handles the -include option. Make the address available in that function by creating a new dynamically allocated option in m_config_new that has the address in the option's private data. asxparser.c also used the global. Making it available through all ways the code could get called required a number of relatively straightforward changes to playtree and menu code.
Diffstat (limited to 'libmenu/menu.c')
-rw-r--r--libmenu/menu.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libmenu/menu.c b/libmenu/menu.c
index 3c47623ed6..6d3c6fb83e 100644
--- a/libmenu/menu.c
+++ b/libmenu/menu.c
@@ -71,6 +71,7 @@ double menu_mouse_y = -1.0;
int menu_mouse_pos_updated = 0;
static struct MPContext *menu_ctx = NULL;
+static struct m_config *menu_mconfig = NULL;
static menu_def_t* menu_list = NULL;
static int menu_count = 0;
static menu_cmd_bindings_t *cmd_bindings = NULL;
@@ -85,11 +86,12 @@ menu_cmd_bindings_t *get_cmd_bindings(const char *name) {
return NULL;
}
-static int menu_parse_config(char* buffer) {
+static int menu_parse_config(char* buffer, struct m_config *mconfig)
+{
char *element,*body, **attribs, *name;
menu_info_t* minfo = NULL;
int r,i;
- ASX_Parser_t* parser = asx_parser_new();
+ ASX_Parser_t* parser = asx_parser_new(mconfig);
while(1) {
r = asx_get_element(parser,&buffer,&element,&body,&attribs);
@@ -211,7 +213,9 @@ static int menu_parse_config(char* buffer) {
#define BUF_STEP 1024
#define BUF_MIN 128
#define BUF_MAX BUF_STEP*1024
-int menu_init(struct MPContext *mpctx, char* cfg_file) {
+int menu_init(struct MPContext *mpctx, struct m_config *mconfig,
+ char* cfg_file)
+{
char* buffer = NULL;
int bl = BUF_STEP, br = 0;
int f, fd;
@@ -250,7 +254,8 @@ int menu_init(struct MPContext *mpctx, char* cfg_file) {
close(fd);
menu_ctx = mpctx;
- f = menu_parse_config(buffer);
+ menu_mconfig = mconfig;
+ f = menu_parse_config(buffer, mconfig);
free(buffer);
return f;
}
@@ -311,6 +316,7 @@ menu_t* menu_open(char *name) {
m->priv_st = &(menu_list[i].type->priv_st);
m->priv = m_struct_copy(m->priv_st,menu_list[i].cfg);
m->ctx = menu_ctx;
+ m->mconfig = menu_mconfig;
m->type = &menu_list[i];
if(menu_list[i].type->open(m,menu_list[i].args))
return m;