summaryrefslogtreecommitdiff
path: root/libegg/eggsmclient-xsmp.c
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-05-07 18:33:55 +0200
committerraveit65 <[email protected]>2022-07-20 00:05:20 +0200
commit3aa64c9521d3ee27e828491aa07aaebda2151343 (patch)
tree72a3df87ade8af5685edc81b17d9ba44e2d6b73f /libegg/eggsmclient-xsmp.c
parent009f9e75769bf9280f1c2205c6f71f0ea8675b6f (diff)
downloadcaja-3aa64c9521d3ee27e828491aa07aaebda2151343.tar.bz2
caja-3aa64c9521d3ee27e828491aa07aaebda2151343.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 808fffc0..7742091d 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,