Mercurial > mplayer.hg
annotate m_config.c @ 36788:64a53697effe
configure: Revise some GUI related messages and output.
author | ib |
---|---|
date | Wed, 19 Feb 2014 01:56:21 +0000 |
parents | 389d43c448b3 |
children |
rev | line source |
---|---|
30429
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
1 /* |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
3 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
8 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
13 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
17 */ |
18258 | 18 |
19 /// \file | |
20 /// \ingroup Config | |
21 | |
8164 | 22 #include "config.h" |
23 | |
24 #include <stdlib.h> | |
25 #include <stdio.h> | |
26 #include <errno.h> | |
27 #include <string.h> | |
35903 | 28 #include <strings.h> |
8164 | 29 #ifdef MP_DEBUG |
30 #include <assert.h> | |
31 #endif | |
32 | |
33 #include "m_config.h" | |
34 #include "m_option.h" | |
35 #include "mp_msg.h" | |
13699
11b249ef87b0
printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>
diego
parents:
10595
diff
changeset
|
36 #include "help_mp.h" |
8164 | 37 |
17471 | 38 #define MAX_PROFILE_DEPTH 20 |
39 | |
32301
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
40 |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
41 static int parse_profile(const m_option_t *opt, const char *name, |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
42 const char *param, void *dst, int src) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
43 { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
44 m_config_t *config = opt->priv; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
45 char **list = NULL; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
46 int i, r; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
47 if (param && !strcmp(param, "help")) { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
48 m_profile_t *p; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
49 if (!config->profiles) { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
50 mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_NoProfileDefined); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
51 return M_OPT_EXIT-1; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
52 } |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
53 mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_AvailableProfiles); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
54 for (p = config->profiles; p; p = p->next) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
55 mp_msg(MSGT_CFGPARSER, MSGL_INFO, "\t%s\t%s\n", p->name, |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
56 p->desc ? p->desc : ""); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
57 mp_msg(MSGT_CFGPARSER, MSGL_INFO, "\n"); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
58 return M_OPT_EXIT-1; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
59 } |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
60 |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
61 r = m_option_type_string_list.parse(opt, name, param, &list,src); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
62 if (r < 0) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
63 return r; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
64 if (!list || !list[0]) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
65 return M_OPT_INVALID; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
66 for (i = 0; list[i]; i++) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
67 if (!m_config_get_profile(config,list[i])) { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
68 mp_msg(MSGT_CFGPARSER, MSGL_WARN, MSGTR_UnknownProfile, list[i]); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
69 r = M_OPT_INVALID; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
70 } |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
71 if (dst) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
72 m_option_copy(opt, dst, &list); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
73 else |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
74 m_option_free(opt, &list); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
75 return r; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
76 } |
17471 | 77 |
78 static void | |
32301
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
79 set_profile(const m_option_t *opt, void *dst, const void *src) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
80 { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
81 m_config_t *config = opt->priv; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
82 m_profile_t *p; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
83 char **list = NULL; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
84 int i; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
85 if (!src || !*(char***)src) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
86 return; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
87 m_option_copy(opt,&list,src); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
88 for (i = 0; list[i]; i++) { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
89 p = m_config_get_profile(config, list[i]); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
90 if (!p) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
91 continue; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
92 m_config_set_profile(config, p); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
93 } |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
94 m_option_free(opt, &list); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
95 } |
17471 | 96 |
32301
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
97 static int show_profile(m_option_t *opt, char* name, char *param) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
98 { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
99 m_config_t *config = opt->priv; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
100 m_profile_t *p; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
101 int i, j; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
102 if (!param) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
103 return M_OPT_MISSING_PARAM; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
104 if (!(p = m_config_get_profile(config, param))) { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
105 mp_msg(MSGT_CFGPARSER, MSGL_ERR, MSGTR_UnknownProfile, param); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
106 return M_OPT_EXIT - 1; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
107 } |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
108 if (!config->profile_depth) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
109 mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_Profile, param, |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
110 p->desc ? p->desc : ""); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
111 config->profile_depth++; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
112 for (i = 0; i < p->num_opts; i++) { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
113 char spc[config->profile_depth + 1]; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
114 for (j = 0; j < config->profile_depth; j++) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
115 spc[j] = ' '; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
116 spc[config->profile_depth] = '\0'; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
117 |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
118 mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s%s=%s\n", spc, |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
119 p->opts[2 * i], p->opts[2 * i + 1]); |
17471 | 120 |
32301
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
121 if (config->profile_depth < MAX_PROFILE_DEPTH && |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
122 !strcmp(p->opts[2*i],"profile")) { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
123 char *e, *list = p->opts[2 * i + 1]; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
124 while ((e = strchr(list, ','))) { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
125 int l = e-list; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
126 char tmp[l+1]; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
127 if (!l) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
128 continue; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
129 memcpy(tmp, list, l); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
130 tmp[l] = '\0'; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
131 show_profile(opt, name, tmp); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
132 list = e+1; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
133 } |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
134 if (list[0] != '\0') |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
135 show_profile(opt, name, list); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
136 } |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
137 } |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
138 config->profile_depth--; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
139 if (!config->profile_depth) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
140 mp_msg(MSGT_CFGPARSER, MSGL_INFO, "\n"); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
141 return M_OPT_EXIT - 1; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
142 } |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
143 |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
144 static int list_options(m_option_t *opt, char* name, char *param) |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
145 { |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
146 m_config_t *config = opt->priv; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
147 m_config_print_option_list(config); |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
148 return M_OPT_EXIT; |
a65635702512
cosmetics: Move some functions around to avoid ugly forward declarations.
diego
parents:
32300
diff
changeset
|
149 } |
17472
526abfe30498
Make -list-options work in both MPlayer and MEncoder.
albeu
parents:
17471
diff
changeset
|
150 |
8164 | 151 m_config_t* |
152 m_config_new(void) { | |
153 m_config_t* config; | |
25962 | 154 static int initialized = 0; |
17471 | 155 static m_option_type_t profile_opt_type; |
156 static m_option_t ref_opts[] = { | |
157 { "profile", NULL, &profile_opt_type, CONF_NOSAVE, 0, 0, NULL }, | |
158 { "show-profile", show_profile, CONF_TYPE_PRINT_FUNC, CONF_NOCFG, 0, 0, NULL }, | |
17472
526abfe30498
Make -list-options work in both MPlayer and MEncoder.
albeu
parents:
17471
diff
changeset
|
159 { "list-options", list_options, CONF_TYPE_PRINT_FUNC, CONF_NOCFG, 0, 0, NULL }, |
17471 | 160 { NULL, NULL, NULL, 0, 0, 0, NULL } |
161 }; | |
162 int i; | |
8164 | 163 |
18879 | 164 config = calloc(1,sizeof(m_config_t)); |
33479 | 165 if (!config) return NULL; |
8164 | 166 config->lvl = 1; // 0 Is the defaults |
25962 | 167 if(!initialized) { |
168 initialized = 1; | |
17471 | 169 profile_opt_type = m_option_type_string_list; |
170 profile_opt_type.parse = parse_profile; | |
171 profile_opt_type.set = set_profile; | |
172 } | |
173 config->self_opts = malloc(sizeof(ref_opts)); | |
33479 | 174 if (!config->self_opts) { |
175 free(config); | |
176 return NULL; | |
177 } | |
17471 | 178 memcpy(config->self_opts,ref_opts,sizeof(ref_opts)); |
179 for(i = 0 ; config->self_opts[i].name ; i++) | |
180 config->self_opts[i].priv = config; | |
181 m_config_register_options(config,config->self_opts); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26408
diff
changeset
|
182 |
8164 | 183 return config; |
184 } | |
185 | |
186 void | |
187 m_config_free(m_config_t* config) { | |
188 m_config_option_t *i = config->opts, *ct; | |
189 m_config_save_slot_t *sl,*st; | |
17471 | 190 m_profile_t *p,*pn; |
191 int j; | |
8164 | 192 |
193 #ifdef MP_DEBUG | |
194 assert(config != NULL); | |
195 #endif | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26408
diff
changeset
|
196 |
8164 | 197 while(i) { |
13824 | 198 if (i->flags & M_CFG_OPT_ALIAS) |
199 sl = NULL; | |
200 else | |
201 sl = i->slots; | |
8164 | 202 while(sl) { |
203 m_option_free(i->opt,sl->data); | |
204 st = sl->prev; | |
205 free(sl); | |
206 sl = st; | |
207 } | |
208 if(i->name != i->opt->name) | |
209 free(i->name); | |
33397 | 210 if(i->opt->p && (i->opt->type->flags & M_OPT_TYPE_DYNAMIC)) |
211 m_option_free(i->opt, i->opt->p); | |
8164 | 212 ct = i->next; |
213 free(i); | |
13824 | 214 i = ct; |
8164 | 215 } |
17471 | 216 for(p = config->profiles ; p ; p = pn) { |
217 pn = p->next; | |
218 free(p->name); | |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32301
diff
changeset
|
219 free(p->desc); |
17471 | 220 for(j = 0 ; j < p->num_opts ; j++) { |
221 free(p->opts[2*j]); | |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32301
diff
changeset
|
222 free(p->opts[2*j + 1]); |
17471 | 223 } |
224 free(p->opts); | |
225 free(p); | |
226 } | |
227 free(config->self_opts); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26408
diff
changeset
|
228 free(config); |
8164 | 229 } |
230 | |
231 void | |
232 m_config_push(m_config_t* config) { | |
233 m_config_option_t *co; | |
234 m_config_save_slot_t *slot; | |
235 | |
236 #ifdef MP_DEBUG | |
237 assert(config != NULL); | |
238 assert(config->lvl > 0); | |
239 #endif | |
240 | |
241 config->lvl++; | |
242 | |
243 for(co = config->opts ; co ; co = co->next ) { | |
244 if(co->opt->type->flags & M_OPT_TYPE_HAS_CHILD) | |
245 continue; | |
246 if(co->opt->flags & (M_OPT_GLOBAL|M_OPT_NOSAVE)) | |
247 continue; | |
21054
7d5035aafcc6
Fix obvious typo, although the exact effect is still unclear to me, see also bug #593.
reimar
parents:
18879
diff
changeset
|
248 if((co->opt->flags & M_OPT_OLD) && !(co->flags & M_CFG_OPT_SET)) |
9912
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
249 continue; |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
250 if(co->flags & M_CFG_OPT_ALIAS) |
8164 | 251 continue; |
252 | |
253 // Update the current status | |
254 m_option_save(co->opt,co->slots->data,co->opt->p); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26408
diff
changeset
|
255 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26408
diff
changeset
|
256 // Allocate a new slot |
18879 | 257 slot = calloc(1,sizeof(m_config_save_slot_t) + co->opt->type->size); |
8164 | 258 slot->lvl = config->lvl; |
259 slot->prev = co->slots; | |
260 co->slots = slot; | |
261 m_option_copy(co->opt,co->slots->data,co->slots->prev->data); | |
9912
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
262 // Reset our set flag |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
263 co->flags &= ~M_CFG_OPT_SET; |
8164 | 264 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26408
diff
changeset
|
265 |
8164 | 266 mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Config pushed level is now %d\n",config->lvl); |
267 } | |
268 | |
269 void | |
270 m_config_pop(m_config_t* config) { | |
271 m_config_option_t *co; | |
272 m_config_save_slot_t *slot; | |
273 | |
274 #ifdef MP_DEBUG | |
275 assert(config != NULL); | |
276 assert(config->lvl > 1); | |
277 #endif | |
278 | |
279 for(co = config->opts ; co ; co = co->next ) { | |
280 int pop = 0; | |
281 if(co->opt->type->flags & M_OPT_TYPE_HAS_CHILD) | |
282 continue; | |
283 if(co->opt->flags & (M_OPT_GLOBAL|M_OPT_NOSAVE)) | |
284 continue; | |
9912
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
285 if(co->flags & M_CFG_OPT_ALIAS) |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
286 continue; |
8164 | 287 if(co->slots->lvl > config->lvl) |
13699
11b249ef87b0
printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>
diego
parents:
10595
diff
changeset
|
288 mp_msg(MSGT_CFGPARSER, MSGL_WARN,MSGTR_SaveSlotTooOld,config->lvl,co->slots->lvl); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26408
diff
changeset
|
289 |
8164 | 290 while(co->slots->lvl >= config->lvl) { |
291 m_option_free(co->opt,co->slots->data); | |
292 slot = co->slots; | |
293 co->slots = slot->prev; | |
294 free(slot); | |
295 pop++; | |
296 } | |
297 if(pop) // We removed some ctx -> set the previous value | |
298 m_option_set(co->opt,co->opt->p,co->slots->data); | |
299 } | |
300 | |
301 config->lvl--; | |
302 mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Config poped level=%d\n",config->lvl); | |
303 } | |
304 | |
305 static void | |
25225
51c23a18a17b
First try to mark some things in m_config correctly as const
reimar
parents:
23868
diff
changeset
|
306 m_config_add_option(m_config_t *config, const m_option_t *arg, const char* prefix) { |
8164 | 307 m_config_option_t *co; |
308 m_config_save_slot_t* sl; | |
309 | |
310 #ifdef MP_DEBUG | |
311 assert(config != NULL); | |
312 assert(config->lvl > 0); | |
313 assert(arg != NULL); | |
314 #endif | |
315 | |
316 // Allocate a new entry for this option | |
18879 | 317 co = calloc(1,sizeof(m_config_option_t) + arg->type->size); |
8164 | 318 co->opt = arg; |
319 | |
320 // Fill in the full name | |
321 if(prefix && strlen(prefix) > 0) { | |
322 int l = strlen(prefix) + 1 + strlen(arg->name) + 1; | |
23806 | 323 co->name = malloc(l); |
8164 | 324 sprintf(co->name,"%s:%s",prefix,arg->name); |
325 } else | |
326 co->name = arg->name; | |
327 | |
23868 | 328 // Option with children -> add them |
8164 | 329 if(arg->type->flags & M_OPT_TYPE_HAS_CHILD) { |
25225
51c23a18a17b
First try to mark some things in m_config correctly as const
reimar
parents:
23868
diff
changeset
|
330 const m_option_t *ol = arg->p; |
8164 | 331 int i; |
13824 | 332 co->slots = NULL; |
8164 | 333 for(i = 0 ; ol[i].name != NULL ; i++) |
334 m_config_add_option(config,&ol[i], co->name); | |
335 } else { | |
9912
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
336 m_config_option_t *i; |
23868 | 337 // Check if there is already an option pointing to this address |
9912
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
338 if(arg->p) { |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
339 for(i = config->opts ; i ; i = i->next ) { |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
340 if(i->opt->p == arg->p) { // So we don't save the same vars more than 1 time |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
341 co->slots = i->slots; |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
342 co->flags |= M_CFG_OPT_ALIAS; |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
343 break; |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
344 } |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
345 } |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
346 } |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
347 if(!(co->flags & M_CFG_OPT_ALIAS)) { |
8164 | 348 // Allocate a slot for the defaults |
18879 | 349 sl = calloc(1,sizeof(m_config_save_slot_t) + arg->type->size); |
8164 | 350 m_option_save(arg,sl->data,(void**)arg->p); |
23868 | 351 // Hack to avoid too much trouble with dynamically allocated data : |
8164 | 352 // We always use a dynamic version |
353 if((arg->type->flags & M_OPT_TYPE_DYNAMIC) && arg->p && (*(void**)arg->p)) { | |
354 *(void**)arg->p = NULL; | |
355 m_option_set(arg,arg->p,sl->data); | |
356 } | |
357 sl->lvl = 0; | |
13824 | 358 sl->prev = NULL; |
18879 | 359 co->slots = calloc(1,sizeof(m_config_save_slot_t) + arg->type->size); |
8164 | 360 co->slots->prev = sl; |
361 co->slots->lvl = config->lvl; | |
362 m_option_copy(co->opt,co->slots->data,sl->data); | |
9912
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
363 } // !M_OPT_ALIAS |
8164 | 364 } |
365 co->next = config->opts; | |
366 config->opts = co; | |
367 } | |
368 | |
369 int | |
25225
51c23a18a17b
First try to mark some things in m_config correctly as const
reimar
parents:
23868
diff
changeset
|
370 m_config_register_options(m_config_t *config, const m_option_t *args) { |
8164 | 371 int i; |
372 | |
373 #ifdef MP_DEBUG | |
374 assert(config != NULL); | |
375 assert(config->lvl > 0); | |
376 assert(args != NULL); | |
377 #endif | |
378 | |
379 for(i = 0 ; args[i].name != NULL ; i++) | |
380 m_config_add_option(config,&args[i],NULL); | |
381 | |
382 return 1; | |
383 } | |
384 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26408
diff
changeset
|
385 static m_config_option_t* |
32300
1ca3d798b518
Mark some function parameters that are not modified as const.
diego
parents:
30728
diff
changeset
|
386 m_config_get_co(const m_config_t *config, char *arg) { |
8164 | 387 m_config_option_t *co; |
388 | |
389 for(co = config->opts ; co ; co = co->next ) { | |
390 int l = strlen(co->name) - 1; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26408
diff
changeset
|
391 if((co->opt->type->flags & M_OPT_TYPE_ALLOW_WILDCARD) && |
8164 | 392 (co->name[l] == '*')) { |
393 if(strncasecmp(co->name,arg,l) == 0) | |
394 return co; | |
395 } else if(strcasecmp(co->name,arg) == 0) | |
396 return co; | |
397 } | |
398 return NULL; | |
399 } | |
400 | |
401 static int | |
32300
1ca3d798b518
Mark some function parameters that are not modified as const.
diego
parents:
30728
diff
changeset
|
402 m_config_parse_option(const m_config_t *config, char *arg, char *param, int set) { |
8164 | 403 m_config_option_t *co; |
404 int r = 0; | |
405 | |
406 #ifdef MP_DEBUG | |
407 assert(config != NULL); | |
408 assert(config->lvl > 0); | |
409 assert(arg != NULL); | |
410 #endif | |
411 | |
412 co = m_config_get_co(config,arg); | |
8892 | 413 if(!co){ |
8894 | 414 // mp_msg(MSGT_CFGPARSER, MSGL_ERR,"Unknown option: %s\n",arg); |
10595
522afd56703c
100l to albeu for his english grammar, and 10l to me becouse I noticed that lately (my backward compatibilty macro uses M_OPT_UNKNOWN)
alex
parents:
10594
diff
changeset
|
415 return M_OPT_UNKNOWN; |
8892 | 416 } |
8164 | 417 |
418 #ifdef MP_DEBUG | |
419 // This is the only mandatory function | |
420 assert(co->opt->type->parse); | |
421 #endif | |
422 | |
23868 | 423 // Check if this option isn't forbidden in the current mode |
8164 | 424 if((config->mode == M_CONFIG_FILE) && (co->opt->flags & M_OPT_NOCFG)) { |
13699
11b249ef87b0
printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>
diego
parents:
10595
diff
changeset
|
425 mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_InvalidCfgfileOption,arg); |
8164 | 426 return M_OPT_INVALID; |
427 } | |
428 if((config->mode == M_COMMAND_LINE) && (co->opt->flags & M_OPT_NOCMD)) { | |
13699
11b249ef87b0
printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>
diego
parents:
10595
diff
changeset
|
429 mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_InvalidCmdlineOption,arg); |
8164 | 430 return M_OPT_INVALID; |
431 } | |
26408
7a36d5941fd8
Replace the trivial command line preparser with a more robust version
albeu
parents:
26288
diff
changeset
|
432 // During command line preparse set only pre-parse options |
7a36d5941fd8
Replace the trivial command line preparser with a more robust version
albeu
parents:
26288
diff
changeset
|
433 // Otherwise only set pre-parse option if they were not already set. |
7a36d5941fd8
Replace the trivial command line preparser with a more robust version
albeu
parents:
26288
diff
changeset
|
434 if(((config->mode == M_COMMAND_LINE_PRE_PARSE) && |
7a36d5941fd8
Replace the trivial command line preparser with a more robust version
albeu
parents:
26288
diff
changeset
|
435 !(co->opt->flags & M_OPT_PRE_PARSE)) || |
7a36d5941fd8
Replace the trivial command line preparser with a more robust version
albeu
parents:
26288
diff
changeset
|
436 ((config->mode != M_COMMAND_LINE_PRE_PARSE) && |
7a36d5941fd8
Replace the trivial command line preparser with a more robust version
albeu
parents:
26288
diff
changeset
|
437 (co->opt->flags & M_OPT_PRE_PARSE) && (co->flags & M_CFG_OPT_SET))) |
7a36d5941fd8
Replace the trivial command line preparser with a more robust version
albeu
parents:
26288
diff
changeset
|
438 set = 0; |
8164 | 439 |
23868 | 440 // Option with children are a bit different to parse |
8164 | 441 if(co->opt->type->flags & M_OPT_TYPE_HAS_CHILD) { |
442 char** lst = NULL; | |
443 int i,sr; | |
444 // Parse the child options | |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9222
diff
changeset
|
445 r = m_option_parse(co->opt,arg,param,&lst,M_COMMAND_LINE); |
8164 | 446 // Set them now |
8894 | 447 if(r >= 0) |
8164 | 448 for(i = 0 ; lst && lst[2*i] ; i++) { |
449 int l = strlen(co->name) + 1 + strlen(lst[2*i]) + 1; | |
450 if(r >= 0) { | |
451 // Build the full name | |
452 char n[l]; | |
453 sprintf(n,"%s:%s",co->name,lst[2*i]); | |
454 sr = m_config_parse_option(config,n,lst[2*i+1],set); | |
8894 | 455 if(sr < 0){ |
10595
522afd56703c
100l to albeu for his english grammar, and 10l to me becouse I noticed that lately (my backward compatibilty macro uses M_OPT_UNKNOWN)
alex
parents:
10594
diff
changeset
|
456 if(sr == M_OPT_UNKNOWN){ |
13699
11b249ef87b0
printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>
diego
parents:
10595
diff
changeset
|
457 mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_InvalidSuboption,co->name,lst[2*i]); |
8894 | 458 r = M_OPT_INVALID; |
459 } else | |
9222 | 460 if(sr == M_OPT_MISSING_PARAM){ |
13699
11b249ef87b0
printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>
diego
parents:
10595
diff
changeset
|
461 mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_MissingSuboptionParameter,lst[2*i],co->name); |
9222 | 462 r = M_OPT_INVALID; |
463 } else | |
8894 | 464 r = sr; |
465 } | |
8164 | 466 } |
467 free(lst[2*i]); | |
468 free(lst[2*i+1]); | |
469 } | |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32301
diff
changeset
|
470 free(lst); |
8164 | 471 } else |
472 r = m_option_parse(co->opt,arg,param,set ? co->slots->data : NULL,config->mode); | |
473 | |
474 // Parsing failed ? | |
475 if(r < 0) | |
476 return r; | |
477 // Set the option | |
478 if(set) { | |
479 m_option_set(co->opt,co->opt->p,co->slots->data); | |
9912
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
9593
diff
changeset
|
480 co->flags |= M_CFG_OPT_SET; |
8164 | 481 } |
482 | |
483 return r; | |
484 } | |
485 | |
486 int | |
487 m_config_set_option(m_config_t *config, char* arg, char* param) { | |
488 mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Setting %s=%s\n",arg,param); | |
489 return m_config_parse_option(config,arg,param,1); | |
490 } | |
491 | |
492 int | |
32300
1ca3d798b518
Mark some function parameters that are not modified as const.
diego
parents:
30728
diff
changeset
|
493 m_config_check_option(const m_config_t *config, char *arg, char *param) { |
9222 | 494 int r; |
8164 | 495 mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Checking %s=%s\n",arg,param); |
9222 | 496 r=m_config_parse_option(config,arg,param,0); |
497 if(r==M_OPT_MISSING_PARAM){ | |
13699
11b249ef87b0
printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>
diego
parents:
10595
diff
changeset
|
498 mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_MissingOptionParameter,arg); |
9222 | 499 return M_OPT_INVALID; |
500 } | |
501 return r; | |
8164 | 502 } |
503 | |
504 | |
25225
51c23a18a17b
First try to mark some things in m_config correctly as const
reimar
parents:
23868
diff
changeset
|
505 const m_option_t* |
32300
1ca3d798b518
Mark some function parameters that are not modified as const.
diego
parents:
30728
diff
changeset
|
506 m_config_get_option(const m_config_t *config, char *arg) { |
8164 | 507 m_config_option_t *co; |
508 | |
509 #ifdef MP_DEBUG | |
510 assert(config != NULL); | |
511 assert(config->lvl > 0); | |
512 assert(arg != NULL); | |
513 #endif | |
514 | |
515 co = m_config_get_co(config,arg); | |
516 if(co) | |
517 return co->opt; | |
518 else | |
519 return NULL; | |
520 } | |
521 | |
522 | |
523 void | |
32300
1ca3d798b518
Mark some function parameters that are not modified as const.
diego
parents:
30728
diff
changeset
|
524 m_config_print_option_list(const m_config_t *config) { |
8164 | 525 char min[50],max[50]; |
526 m_config_option_t* co; | |
527 int count = 0; | |
528 | |
529 if(!config->opts) return; | |
530 | |
17481
99c0caec4677
Fix the MSG?_FIXME and make the profiles help translatable.
albeu
parents:
17472
diff
changeset
|
531 mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_OptionListHeader); |
8164 | 532 for(co = config->opts ; co ; co = co->next) { |
25225
51c23a18a17b
First try to mark some things in m_config correctly as const
reimar
parents:
23868
diff
changeset
|
533 const m_option_t* opt = co->opt; |
8164 | 534 if(opt->type->flags & M_OPT_TYPE_HAS_CHILD) continue; |
535 if(opt->flags & M_OPT_MIN) | |
536 sprintf(min,"%-8.0f",opt->min); | |
537 else | |
538 strcpy(min,"No"); | |
539 if(opt->flags & M_OPT_MAX) | |
540 sprintf(max,"%-8.0f",opt->max); | |
541 else | |
542 strcpy(max,"No"); | |
17481
99c0caec4677
Fix the MSG?_FIXME and make the profiles help translatable.
albeu
parents:
17472
diff
changeset
|
543 mp_msg(MSGT_CFGPARSER, MSGL_INFO, " %-20.20s %-15.15s %-10.10s %-10.10s %-3.3s %-3.3s %-3.3s\n", |
8164 | 544 co->name, |
545 co->opt->type->name, | |
546 min, | |
547 max, | |
548 opt->flags & CONF_GLOBAL ? "Yes" : "No", | |
549 opt->flags & CONF_NOCMD ? "No" : "Yes", | |
550 opt->flags & CONF_NOCFG ? "No" : "Yes"); | |
551 count++; | |
552 } | |
17481
99c0caec4677
Fix the MSG?_FIXME and make the profiles help translatable.
albeu
parents:
17472
diff
changeset
|
553 mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_TotalOptions,count); |
8164 | 554 } |
17471 | 555 |
556 m_profile_t* | |
32300
1ca3d798b518
Mark some function parameters that are not modified as const.
diego
parents:
30728
diff
changeset
|
557 m_config_get_profile(const m_config_t *config, char *name) { |
17471 | 558 m_profile_t* p; |
559 for(p = config->profiles ; p ; p = p->next) | |
560 if(!strcmp(p->name,name)) return p; | |
561 return NULL; | |
562 } | |
563 | |
564 m_profile_t* | |
565 m_config_add_profile(m_config_t* config, char* name) { | |
566 m_profile_t* p = m_config_get_profile(config,name); | |
567 if(p) return p; | |
568 p = calloc(1,sizeof(m_profile_t)); | |
569 p->name = strdup(name); | |
570 p->next = config->profiles; | |
571 config->profiles = p; | |
572 return p; | |
573 } | |
574 | |
575 void | |
576 m_profile_set_desc(m_profile_t* p, char* desc) { | |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32301
diff
changeset
|
577 free(p->desc); |
17471 | 578 p->desc = desc ? strdup(desc) : NULL; |
579 } | |
580 | |
581 int | |
582 m_config_set_profile_option(m_config_t* config, m_profile_t* p, | |
583 char* name, char* val) { | |
584 int i = m_config_check_option(config,name,val); | |
585 if(i < 0) return i; | |
586 if(p->opts) p->opts = realloc(p->opts,2*(p->num_opts+2)*sizeof(char*)); | |
587 else p->opts = malloc(2*(p->num_opts+2)*sizeof(char*)); | |
588 p->opts[p->num_opts*2] = strdup(name); | |
589 p->opts[p->num_opts*2+1] = val ? strdup(val) : NULL; | |
590 p->num_opts++; | |
591 p->opts[p->num_opts*2] = p->opts[p->num_opts*2+1] = NULL; | |
17856 | 592 return 1; |
17471 | 593 } |
594 | |
25634 | 595 void |
17471 | 596 m_config_set_profile(m_config_t* config, m_profile_t* p) { |
597 int i; | |
598 if(config->profile_depth > MAX_PROFILE_DEPTH) { | |
18335 | 599 mp_msg(MSGT_CFGPARSER, MSGL_WARN, MSGTR_ProfileInclusionTooDeep); |
17471 | 600 return; |
601 } | |
602 config->profile_depth++; | |
603 for(i = 0 ; i < p->num_opts ; i++) | |
604 m_config_set_option(config,p->opts[2*i],p->opts[2*i+1]); | |
605 config->profile_depth--; | |
606 } |