fix warning about discarding const

This commit is contained in:
Sascha Kruse 2013-03-20 09:34:15 +00:00
parent 75366af9fd
commit 1a9c20ad63

14
menu.c
View File

@ -137,18 +137,19 @@ void invoke_action(const char *action)
*/ */
void dispatch_menu_result(const char *input) void dispatch_menu_result(const char *input)
{ {
g_strstrip(input); char *in = strdup(input);
switch (input[0]) { g_strstrip(in);
switch (in[0]) {
case '#': case '#':
invoke_action(input + 1); invoke_action(in + 1);
break; break;
case '[': // named url. skip name and continue case '[': // named url. skip name and continue
input = strchr(input, ']'); in = strchr(in, ']');
if (input == NULL) if (in == NULL)
break; break;
default: default:
{ // test and open url { // test and open url
char *maybe_url = extract_urls(input); char *maybe_url = extract_urls(in);
if (maybe_url) { if (maybe_url) {
open_browser(maybe_url); open_browser(maybe_url);
free(maybe_url); free(maybe_url);
@ -156,6 +157,7 @@ void dispatch_menu_result(const char *input)
} }
} }
} }
free(in);
} }
/* /*