summaryrefslogtreecommitdiff
path: root/applets/fish
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-08-04 13:11:42 +0200
committerraveit65 <[email protected]>2020-09-07 09:11:05 +0200
commit8f8b7316cc7504a4618705c562ead1ae65dabbdc (patch)
treec536e6c8079781851f2456528042e19497ee5315 /applets/fish
parent59da25f28bc2678cc38bc1def53ca1c4dbf9cc0b (diff)
downloadmate-panel-8f8b7316cc7504a4618705c562ead1ae65dabbdc.tar.bz2
mate-panel-8f8b7316cc7504a4618705c562ead1ae65dabbdc.tar.xz
Remove variableScope warnings reported by cppcheck
cppcheck --enable=all . 2> err.txt grep variableScope err.txt
Diffstat (limited to 'applets/fish')
-rw-r--r--applets/fish/fish.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/applets/fish/fish.c b/applets/fish/fish.c
index afa8c429..d77db1d9 100644
--- a/applets/fish/fish.c
+++ b/applets/fish/fish.c
@@ -261,7 +261,6 @@ static void command_value_changed(GtkEntry* entry, FishApplet *fish)
!strcmp (text, "uptime") ||
!strncmp (text, "tail ", 5)) {
static gboolean message_given = FALSE;
- char *message;
const char *warning_format =
_("Warning: The command "
"appears to be something actually useful.\n"
@@ -272,13 +271,10 @@ static void command_value_changed(GtkEntry* entry, FishApplet *fish)
"which would make the applet "
"\"practical\" or useful.");
- if ( ! message_given) {
- message = g_strdup_printf (warning_format, fish->name);
-
+ if (!message_given) {
+ char *message = g_strdup_printf (warning_format, fish->name);
something_fishy_going_on (fish, message);
-
g_free (message);
-
message_given = TRUE;
}
}
@@ -729,7 +725,6 @@ static void clear_fortune_text(FishApplet* fish)
static gboolean fish_read_output(GIOChannel* source, GIOCondition condition, gpointer data)
{
char output[4096];
- char *utf8_output;
gsize bytes_read;
GError *error = NULL;
GIOStatus status;
@@ -763,6 +758,8 @@ static gboolean fish_read_output(GIOChannel* source, GIOCondition condition, gpo
return TRUE;
if (bytes_read > 0) {
+ char *utf8_output;
+
/* The output is not guarantied to be in UTF-8 format, most
* likely it's just in ASCII-7 or in the user locale
*/