summaryrefslogtreecommitdiff
path: root/libegg/eggsmclient-xsmp.c
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-05-07 18:33:55 +0200
committerlukefromdc <[email protected]>2019-05-09 05:16:43 +0000
commit2768c0c160f2af5d04edf99da92b83fc087251fe (patch)
tree5383455dbbb3ba85f5d38cedea7d87ad323ead09 /libegg/eggsmclient-xsmp.c
parent4993f0eaa7860b7bf7408172a612d7a12c09bbb9 (diff)
downloadcaja-2768c0c160f2af5d04edf99da92b83fc087251fe.tar.bz2
caja-2768c0c160f2af5d04edf99da92b83fc087251fe.tar.xz
libegg: reduce the scope of some variables
Fixes 'cppcheck' warnings: [libegg/eggdesktopfile.c:483]: (style) The scope of the variable 'try_exec' can be reduced. [libegg/eggdesktopfile.c:483]: (style) The scope of the variable 'found_program' can be reduced. [libegg/eggdesktopfile.c:484]: (style) The scope of the variable 'only_show_in' can be reduced. [libegg/eggdesktopfile.c:484]: (style) The scope of the variable 'not_show_in' can be reduced. [libegg/eggdesktopfile.c:486]: (style) The scope of the variable 'i' can be reduced. [libegg/eggdesktopfile.c:608]: (style) The scope of the variable 'p' can be reduced. [libegg/eggsmclient-xsmp.c:227]: (style) The scope of the variable 'cmdline' can be reduced. [libegg/eggsmclient-xsmp.c:773]: (style) The scope of the variable 'fd' can be reduced. [libegg/eggsmclient-xsmp.c:808]: (style) The scope of the variable 'keys' can be reduced. [libegg/eggtreemultidnd.c:305]: (style) The scope of the variable 'context' can be reduced.
Diffstat (limited to 'libegg/eggsmclient-xsmp.c')
-rw-r--r--libegg/eggsmclient-xsmp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libegg/eggsmclient-xsmp.c b/libegg/eggsmclient-xsmp.c
index d93dcd1a..b95dc518 100644
--- a/libegg/eggsmclient-xsmp.c
+++ b/libegg/eggsmclient-xsmp.c
@@ -224,7 +224,7 @@ sm_client_xsmp_set_initial_properties (gpointer user_data)
if (desktop_file)
{
GError *err = NULL;
- char *cmdline, **argv;
+ char **argv;
int argc;
if (xsmp->restart_style == SmRestartIfRunning)
@@ -236,6 +236,8 @@ sm_client_xsmp_set_initial_properties (gpointer user_data)
if (!xsmp->set_restart_command)
{
+ char *cmdline;
+
cmdline = egg_desktop_file_parse_exec (desktop_file, NULL, &err);
if (cmdline && g_shell_parse_argv (cmdline, &argc, &argv, &err))
{
@@ -770,7 +772,7 @@ save_state (EggSMClientXSMP *xsmp)
char *state_file_path, *data;
EggDesktopFile *desktop_file;
GPtrArray *restart;
- int offset, fd;
+ int offset;
/* We set xsmp->state before emitting save_state, but our caller is
* responsible for setting it back afterward.
@@ -805,11 +807,13 @@ save_state (EggSMClientXSMP *xsmp)
G_KEY_FILE_KEEP_TRANSLATIONS, NULL))
{
guint g, k, i;
- char **groups, **keys, *value, *exec;
+ char **groups, *value, *exec;
groups = g_key_file_get_groups (state_file, NULL);
for (g = 0; groups[g]; g++)
{
+ char **keys;
+
keys = g_key_file_get_keys (state_file, groups[g], NULL, NULL);
for (k = 0; keys[k]; k++)
{
@@ -861,6 +865,8 @@ save_state (EggSMClientXSMP *xsmp)
offset = 0;
while (1)
{
+ int fd;
+
state_file_path = g_strdup_printf ("%s%csession-state%c%s-%ld.%s",
g_get_user_config_dir (),
G_DIR_SEPARATOR, G_DIR_SEPARATOR,