1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 00:02:13 +00:00

options: add special -leak-report option

Add a special option "-leak-report" that enables talloc leak
reporting.  It only works if it's given as the first argument.

The code abuses the CONF_TYPE_PRINT option type to make main option
parsing ignore the option. The parser incorrectly consumed the
following commandline argument as a "parameter" for options of this
type when they had the flag to not exit after printing the message.
Fix this. It makes no difference for any previously existing option I
think.
This commit is contained in:
Uoti Urpala 2011-01-15 22:26:27 +02:00
parent ac79632ded
commit 8636eb77c5
3 changed files with 4 additions and 2 deletions

View File

@ -296,6 +296,7 @@ const m_option_t mplayer_opts[]={
{"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
#endif
{"leak-report", "", CONF_TYPE_PRINT, 0, 0, 0, (void*)1},
// these should be removed when gmplayer is forgotten
{"gui", "Internal GUI was removed. Use some other frontend instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
{"nogui", "Internal GUI was removed, -nogui is no longer valid.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},

View File

@ -970,7 +970,7 @@ static int parse_print(const m_option_t* opt,const char *name, const char *param
if(opt->priv == NULL)
return M_OPT_EXIT;
return 1;
return 0;
}
const m_option_type_t m_option_type_print = {

View File

@ -3871,7 +3871,8 @@ if (HAVE_CMOV)
* file for some tools to link against. */
#ifndef DISABLE_MAIN
int main(int argc,char* argv[]){
if (argc > 1 && !strcmp(argv[1], "-leak-report"))
talloc_enable_leak_report();
char * mem_ptr;