comparison libmenu/menu.c @ 21797:14061bc22cb3

fix gprof support (aka work around gprof's brain dead design) as stated here: http://sourceware.org/binutils/docs-2.17/gprof/Implementation.html mcount() is a symbol reserved by gprof to perform instrumentation, so we shouldn't declare a symbol that has this name Fixes issue discussed here: date: Jan 3, 2007 3:17 PM subject: [MPlayer-advusers] gcc, mplayer and profile (mcount)
author gpoirier
date Thu, 04 Jan 2007 16:00:27 +0000
parents d03b71ab8b65
children 83366c8e1928
comparison
equal deleted inserted replaced
21796:3eec8eba4906 21797:14061bc22cb3
51 void* cfg; 51 void* cfg;
52 char* args; 52 char* args;
53 } menu_def_t; 53 } menu_def_t;
54 54
55 static menu_def_t* menu_list = NULL; 55 static menu_def_t* menu_list = NULL;
56 static int mcount = 0; 56 static int menu_count = 0;
57 57
58 58
59 static int menu_parse_config(char* buffer) { 59 static int menu_parse_config(char* buffer) {
60 char *element,*body, **attribs, *name; 60 char *element,*body, **attribs, *name;
61 menu_info_t* minfo = NULL; 61 menu_info_t* minfo = NULL;
89 break; 89 break;
90 } 90 }
91 } 91 }
92 // Got it : add this to our list 92 // Got it : add this to our list
93 if(minfo) { 93 if(minfo) {
94 menu_list = realloc(menu_list,(mcount+2)*sizeof(menu_def_t)); 94 menu_list = realloc(menu_list,(menu_count+2)*sizeof(menu_def_t));
95 menu_list[mcount].name = name; 95 menu_list[menu_count].name = name;
96 menu_list[mcount].type = minfo; 96 menu_list[menu_count].type = minfo;
97 menu_list[mcount].cfg = m_struct_alloc(&minfo->priv_st); 97 menu_list[menu_count].cfg = m_struct_alloc(&minfo->priv_st);
98 menu_list[mcount].args = body; 98 menu_list[menu_count].args = body;
99 // Setup the attribs 99 // Setup the attribs
100 for(i = 0 ; attribs[2*i] ; i++) { 100 for(i = 0 ; attribs[2*i] ; i++) {
101 if(strcasecmp(attribs[2*i],"name") == 0) continue; 101 if(strcasecmp(attribs[2*i],"name") == 0) continue;
102 if(!m_struct_set(&minfo->priv_st,menu_list[mcount].cfg,attribs[2*i], attribs[2*i+1])) 102 if(!m_struct_set(&minfo->priv_st,menu_list[menu_count].cfg,attribs[2*i], attribs[2*i+1]))
103 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_BadAttrib,attribs[2*i],attribs[2*i+1], 103 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_BadAttrib,attribs[2*i],attribs[2*i+1],
104 name,parser->line); 104 name,parser->line);
105 } 105 }
106 mcount++; 106 menu_count++;
107 memset(&menu_list[mcount],0,sizeof(menu_def_t)); 107 memset(&menu_list[menu_count],0,sizeof(menu_def_t));
108 } else { 108 } else {
109 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuType,element,parser->line); 109 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuType,element,parser->line);
110 free(name); 110 free(name);
111 if(body) free(body); 111 if(body) free(body);
112 } 112 }
172 free(menu_list[i].name); 172 free(menu_list[i].name);
173 m_struct_free(&menu_list[i].type->priv_st,menu_list[i].cfg); 173 m_struct_free(&menu_list[i].type->priv_st,menu_list[i].cfg);
174 if(menu_list[i].args) free(menu_list[i].args); 174 if(menu_list[i].args) free(menu_list[i].args);
175 } 175 }
176 free(menu_list); 176 free(menu_list);
177 mcount = 0; 177 menu_count = 0;
178 } 178 }
179 179
180 /// Default read_key function 180 /// Default read_key function
181 void menu_dflt_read_key(menu_t* menu,int cmd) { 181 void menu_dflt_read_key(menu_t* menu,int cmd) {
182 switch(cmd) { 182 switch(cmd) {