From 9bc69fd715b8bb45c0c45a27c71ce2cc49b0c7d3 Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 21 Dec 2020 15:39:17 +0100 Subject: Remove cppcheck warnings about the variable scope can be reduced --- plugins/hddtemp/hddtemp-plugin.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'plugins/hddtemp') diff --git a/plugins/hddtemp/hddtemp-plugin.c b/plugins/hddtemp/hddtemp-plugin.c index 3df514b..be77b1d 100644 --- a/plugins/hddtemp/hddtemp-plugin.c +++ b/plugins/hddtemp/hddtemp-plugin.c @@ -60,11 +60,8 @@ enum { static gchar buffer[HDDTEMP_OUTPUT_BUFFER_LENGTH]; static const gchar *hddtemp_plugin_query_hddtemp_daemon(GError **error) { - int sockfd; - ssize_t n = 1; guint output_length = 0; static gboolean first_run = TRUE; - gchar *pc; struct sockaddr_in address; static gint64 previous_query_time; @@ -80,6 +77,10 @@ static const gchar *hddtemp_plugin_query_hddtemp_daemon(GError **error) { hddtemp daemon will only actually send a new value if is > 60 seconds */ if (first_run || current_query_time - previous_query_time > G_TIME_SPAN_MINUTE) { + int sockfd; + ssize_t n; + gchar *pc; + previous_query_time = current_query_time; if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { -- cgit v1.2.1