Skip to content
Browse files

fix warning about discarding const

  • Loading branch information...
1 parent 75366af commit 1a9c20ad639af11886e82a458825b245f5fd6abe @knopwob committed Mar 20, 2013
Showing with 8 additions and 6 deletions.
  1. +8 −6 menu.c
View
14 menu.c
@@ -137,25 +137,27 @@ void invoke_action(const char *action)
*/
void dispatch_menu_result(const char *input)
{
- g_strstrip(input);
- switch (input[0]) {
+ char *in = strdup(input);
+ g_strstrip(in);
+ switch (in[0]) {
case '#':
- invoke_action(input + 1);
+ invoke_action(in + 1);
break;
case '[': // named url. skip name and continue
- input = strchr(input, ']');
- if (input == NULL)
+ in = strchr(in, ']');
+ if (in == NULL)
break;
default:
{ // test and open url
- char *maybe_url = extract_urls(input);
+ char *maybe_url = extract_urls(in);
if (maybe_url) {
open_browser(maybe_url);
free(maybe_url);
break;
}
}
}
+ free(in);
}
/*

0 comments on commit 1a9c20a

Please sign in to comment.
Something went wrong with that request. Please try again.