From f9a1093e45bb249a6c6a988c497248bf3051b6b3 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 12 Mar 2014 11:15:40 +0100 Subject: [PATCH] spawn: Remove useless argv[0] calculation Since commit 3c40d6b, the passed in argument is decomposed into an array of strings before the sn-related code runs. This means we already know argv[0] and thus we don't need the code here that tries to figure it out again. Signed-off-by: Uli Schlachter --- spawn.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/spawn.c b/spawn.c index 287e126d..63b28752 100644 --- a/spawn.c +++ b/spawn.c @@ -343,23 +343,11 @@ luaA_spawn(lua_State *L) SnLauncherContext *context = NULL; if(use_sn) { - char *cmdname, *space; - const char *first_no_space_char = argv[0]; - /* Look for the first char which is not space */ - while(*first_no_space_char && *first_no_space_char == ' ') - first_no_space_char++; - /* Look for space in the string to get the command name. */ - if((space = strchr(first_no_space_char, ' '))) - cmdname = a_strndup(argv[0], space - argv[0]); - else - cmdname = a_strdup(argv[0]); - context = sn_launcher_context_new(globalconf.sndisplay, globalconf.default_screen); sn_launcher_context_set_name(context, "awesome"); sn_launcher_context_set_description(context, "awesome spawn"); - sn_launcher_context_set_binary_name(context, cmdname); - sn_launcher_context_initiate(context, "awesome", cmdname, globalconf.timestamp); - p_delete(&cmdname); + sn_launcher_context_set_binary_name(context, argv[0]); + sn_launcher_context_initiate(context, "awesome", argv[0], globalconf.timestamp); /* app will have AWESOME_SPAWN_TIMEOUT seconds to complete, * or the timeout function will terminate the launch sequence anyway */ -- 2.11.4.GIT