Mercurial > mplayer.hg
comparison m_config.c @ 23868:09c2fe1e021d
Fix some typos in comments
author | reimar |
---|---|
date | Sat, 28 Jul 2007 10:14:42 +0000 |
parents | 0a38ad149c5c |
children | 51c23a18a17b |
comparison
equal
deleted
inserted
replaced
23867:5f32a5415726 | 23868:09c2fe1e021d |
---|---|
202 co->name = malloc(l); | 202 co->name = malloc(l); |
203 sprintf(co->name,"%s:%s",prefix,arg->name); | 203 sprintf(co->name,"%s:%s",prefix,arg->name); |
204 } else | 204 } else |
205 co->name = arg->name; | 205 co->name = arg->name; |
206 | 206 |
207 // Option with childs -> add them | 207 // Option with children -> add them |
208 if(arg->type->flags & M_OPT_TYPE_HAS_CHILD) { | 208 if(arg->type->flags & M_OPT_TYPE_HAS_CHILD) { |
209 m_option_t *ol = arg->p; | 209 m_option_t *ol = arg->p; |
210 int i; | 210 int i; |
211 co->slots = NULL; | 211 co->slots = NULL; |
212 for(i = 0 ; ol[i].name != NULL ; i++) | 212 for(i = 0 ; ol[i].name != NULL ; i++) |
213 m_config_add_option(config,&ol[i], co->name); | 213 m_config_add_option(config,&ol[i], co->name); |
214 } else { | 214 } else { |
215 m_config_option_t *i; | 215 m_config_option_t *i; |
216 // Check if there is alredy an option pointing to this address | 216 // Check if there is already an option pointing to this address |
217 if(arg->p) { | 217 if(arg->p) { |
218 for(i = config->opts ; i ; i = i->next ) { | 218 for(i = config->opts ; i ; i = i->next ) { |
219 if(i->opt->p == arg->p) { // So we don't save the same vars more than 1 time | 219 if(i->opt->p == arg->p) { // So we don't save the same vars more than 1 time |
220 co->slots = i->slots; | 220 co->slots = i->slots; |
221 co->flags |= M_CFG_OPT_ALIAS; | 221 co->flags |= M_CFG_OPT_ALIAS; |
225 } | 225 } |
226 if(!(co->flags & M_CFG_OPT_ALIAS)) { | 226 if(!(co->flags & M_CFG_OPT_ALIAS)) { |
227 // Allocate a slot for the defaults | 227 // Allocate a slot for the defaults |
228 sl = calloc(1,sizeof(m_config_save_slot_t) + arg->type->size); | 228 sl = calloc(1,sizeof(m_config_save_slot_t) + arg->type->size); |
229 m_option_save(arg,sl->data,(void**)arg->p); | 229 m_option_save(arg,sl->data,(void**)arg->p); |
230 // Hack to avoid too much trouble with dynamicly allocated data : | 230 // Hack to avoid too much trouble with dynamically allocated data : |
231 // We always use a dynamic version | 231 // We always use a dynamic version |
232 if((arg->type->flags & M_OPT_TYPE_DYNAMIC) && arg->p && (*(void**)arg->p)) { | 232 if((arg->type->flags & M_OPT_TYPE_DYNAMIC) && arg->p && (*(void**)arg->p)) { |
233 *(void**)arg->p = NULL; | 233 *(void**)arg->p = NULL; |
234 m_option_set(arg,arg->p,sl->data); | 234 m_option_set(arg,arg->p,sl->data); |
235 } | 235 } |
297 #ifdef MP_DEBUG | 297 #ifdef MP_DEBUG |
298 // This is the only mandatory function | 298 // This is the only mandatory function |
299 assert(co->opt->type->parse); | 299 assert(co->opt->type->parse); |
300 #endif | 300 #endif |
301 | 301 |
302 // Check if this option isn't forbiden in the current mode | 302 // Check if this option isn't forbidden in the current mode |
303 if((config->mode == M_CONFIG_FILE) && (co->opt->flags & M_OPT_NOCFG)) { | 303 if((config->mode == M_CONFIG_FILE) && (co->opt->flags & M_OPT_NOCFG)) { |
304 mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_InvalidCfgfileOption,arg); | 304 mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_InvalidCfgfileOption,arg); |
305 return M_OPT_INVALID; | 305 return M_OPT_INVALID; |
306 } | 306 } |
307 if((config->mode == M_COMMAND_LINE) && (co->opt->flags & M_OPT_NOCMD)) { | 307 if((config->mode == M_COMMAND_LINE) && (co->opt->flags & M_OPT_NOCMD)) { |
308 mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_InvalidCmdlineOption,arg); | 308 mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_InvalidCmdlineOption,arg); |
309 return M_OPT_INVALID; | 309 return M_OPT_INVALID; |
310 } | 310 } |
311 | 311 |
312 // Option with childs are a bit different to parse | 312 // Option with children are a bit different to parse |
313 if(co->opt->type->flags & M_OPT_TYPE_HAS_CHILD) { | 313 if(co->opt->type->flags & M_OPT_TYPE_HAS_CHILD) { |
314 char** lst = NULL; | 314 char** lst = NULL; |
315 int i,sr; | 315 int i,sr; |
316 // Parse the child options | 316 // Parse the child options |
317 r = m_option_parse(co->opt,arg,param,&lst,M_COMMAND_LINE); | 317 r = m_option_parse(co->opt,arg,param,&lst,M_COMMAND_LINE); |