summary refs log tree commit diff stats
path: root/plugins
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-07-19 13:36:13 +1000
committerTingPing <tingping@tingping.se>2014-11-02 14:41:20 -0500
commitf83d78dd2801c7e4bee406379d3119f8852cf297 (patch)
tree72322bd80d992ead5359ed70faeeac1ae6a73a20 /plugins
parent9fb4eb5107a133a4c0492f11f02cdeb014042786 (diff)
Warning cleanup
- ignoring const
- declarations after statements
- some C files didnt include own headers (risking them getting out of sync)

Closes #1064
Diffstat (limited to 'plugins')
-rw-r--r--plugins/python/python.c8
-rw-r--r--plugins/sysinfo/hwmon.c3
-rw-r--r--plugins/sysinfo/match.c4
-rw-r--r--plugins/sysinfo/parse.c1
-rw-r--r--plugins/sysinfo/pci.c3
-rw-r--r--plugins/sysinfo/xsys.c2
6 files changed, 13 insertions, 8 deletions
diff --git a/plugins/python/python.c b/plugins/python/python.c
index 1904a3e9..0ce6ad6e 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -414,6 +414,9 @@ Util_BuildEOLList(char *word[])
 	PyObject *list;
 	int listsize = 31;
 	int i;
+	char *accum = NULL;
+	char *last = NULL;
+
 	/* Find the last valid array member; there may be intermediate NULLs that
 	 * would otherwise cause us to drop some members. */
 	while (listsize > 0 &&
@@ -424,10 +427,9 @@ Util_BuildEOLList(char *word[])
 		PyErr_Print();
 		return NULL;
 	}
-	char *accum = NULL;
-	char *last = NULL;
 	for (i = listsize; i > 0; i--) {
 		char *part = word[i];
+		PyObject *uni_part;
 		if (accum == NULL) {
 			accum = g_strdup (part);
 		} else if (part != NULL && part[0] != 0) {
@@ -443,7 +445,7 @@ Util_BuildEOLList(char *word[])
 				return NULL;
 			}
 		}
-		PyObject *uni_part = PyUnicode_FromString(accum);
+		uni_part = PyUnicode_FromString(accum);
 		PyList_SetItem(list, i - 1, uni_part);
 	}
 
diff --git a/plugins/sysinfo/hwmon.c b/plugins/sysinfo/hwmon.c
index 389244ac..e562458f 100644
--- a/plugins/sysinfo/hwmon.c
+++ b/plugins/sysinfo/hwmon.c
@@ -53,8 +53,9 @@ void get_hwmon_chip_name(char *name)
 void get_hwmon_temp(unsigned int *value, unsigned int *sensor)
 {
 	char buffer[bsize];
+	FILE *fp;
 	snprintf(buffer, bsize, "/sys/class/hwmon/hwmon0/device/temp%i_input", *sensor);
-	FILE *fp = fopen(buffer, "r");
+	fp = fopen(buffer, "r");
 	if(fp != NULL) {
 		if(fgets(buffer, bsize, fp) != NULL)
 			*value = atoi(buffer);
diff --git a/plugins/sysinfo/match.c b/plugins/sysinfo/match.c
index adfbff1b..f8a8cf96 100644
--- a/plugins/sysinfo/match.c
+++ b/plugins/sysinfo/match.c
@@ -32,12 +32,12 @@ float percentage(unsigned long long *free, unsigned long long *total)
 
 char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned long long *total_k)
 {
-        char *result, **quantity;
+	char *quantities[] = { "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB", 0 };
+	char *result, **quantity;
 	double free_space, total_space;
 	free_space = *free_k;
 	total_space = *total_k;
         result = malloc(bsize * sizeof(char));
-	char *quantities[] = { "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB", 0 };
 	if (total_space == 0)
 	{
 		snprintf(result, bsize, "%s: none", desc);
diff --git a/plugins/sysinfo/parse.c b/plugins/sysinfo/parse.c
index 4c15897a..3f1ad6c5 100644
--- a/plugins/sysinfo/parse.c
+++ b/plugins/sysinfo/parse.c
@@ -34,6 +34,7 @@
 #include "match.h"
 #include "hwmon.h"
 #include "xsys.h"
+#include "parse.h"
 
 int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned int *count)
 {
diff --git a/plugins/sysinfo/pci.c b/plugins/sysinfo/pci.c
index bc8fb11f..9946c446 100644
--- a/plugins/sysinfo/pci.c
+++ b/plugins/sysinfo/pci.c
@@ -115,9 +115,10 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
 	char devicename[bsize/2] = "";
 	char *position;
 	int cardfound = 0;
+	FILE *fp;
 
 	sysinfo_get_pciids (buffer);
-	FILE *fp = fopen (buffer, "r");
+	fp = fopen (buffer, "r");
 
 	if(fp == NULL) {
 		snprintf(fullname, bsize, "%s:%s", vendor, device);
diff --git a/plugins/sysinfo/xsys.c b/plugins/sysinfo/xsys.c
index 4ab6e873..79abcea1 100644
--- a/plugins/sysinfo/xsys.c
+++ b/plugins/sysinfo/xsys.c
@@ -878,11 +878,11 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
 int
 hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
 {
+	char buffer[bsize];
 	ph = plugin_handle;
 	*plugin_name    = name;
 	*plugin_desc    = desc;
 	*plugin_version = version;
-	char buffer[bsize];
 
 	hexchat_hook_command (ph, "SYSINFO",	HEXCHAT_PRI_NORM,	sysinfo_cb,	sysinfo_help, NULL);
 	hexchat_hook_command (ph, "NETDATA",	HEXCHAT_PRI_NORM,	netdata_cb,	NULL, NULL);