diff options
| author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2009-03-29 10:38:31 -0300 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2009-03-29 10:38:31 -0300 | 
| commit | 2d0724c17ece708e93126345fb24f4683f51ed17 (patch) | |
| tree | 68c08cadca9193e736dd36b65d835db0335f8af8 | |
| parent | 43b9f535ee40022e41f9c618e32f3c2f3a7b1469 (diff) | |
Cleanups
| -rw-r--r-- | hardinfo2/Makefile.in | 18 | ||||
| -rw-r--r-- | hardinfo2/arch/common/languages.h | 2 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/alsa.h | 2 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/battery.h | 2 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/dmi.h | 4 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/loadavg.h | 2 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/modules.h | 2 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/os.h | 14 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/pci.h | 2 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/storage.h | 10 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/uptime.h | 2 | ||||
| -rw-r--r-- | hardinfo2/network.c | 6 | ||||
| -rw-r--r-- | hardinfo2/shell.c | 8 | 
13 files changed, 30 insertions, 44 deletions
| diff --git a/hardinfo2/Makefile.in b/hardinfo2/Makefile.in index 5639db69..57363ea5 100644 --- a/hardinfo2/Makefile.in +++ b/hardinfo2/Makefile.in @@ -13,9 +13,7 @@ BENCHMARK_OBJECTS = fbench.o sha1.o blowfish.o md5.o nqueens.o fftbench.o  MODULES = computer.so devices.so benchmark.so network.so -all:	$(OBJECTS) $(MODULES) hardinfo - -hardinfo: +all:	$(OBJECTS) $(MODULES)  	$(CC) $(CCFLAGS) -o hardinfo -Wl,-export-dynamic $(OBJECTS) $(GTK_LIBS) \  		$(SOUP_LIBS) @@ -38,14 +36,12 @@ nqueens.o:  	$(CCSLOW) $(CCFLAGS) $(CFLAGS) -c nqueens.c -o $@  benchmark.so:	benchmark.c -	@echo "[01;34m--- Module: $< ($@)[00m"  	make $(BENCHMARK_OBJECTS)  	$(CCSLOW) $(CCFLAGS) $(CFLAGS) -o $@ -shared $< $(BENCHMARK_OBJECTS) \  		$(GTK_FLAGS) $(GTK_LIBS)  	ln -sf ../$@ modules  %.so:	%.c -	@echo "[01;34m--- Module: $< ($@)[00m"  	$(CC) $(CCFLAGS) $(CFLAGS) -o $@ -shared $< $(GTK_FLAGS) $(GTK_LIBS)  	ln -sf ../$@ modules @@ -68,39 +64,27 @@ deb:	dist-clean  	dpkg-buildpackage -rfakeroot -k${USER}  install:	all -	@echo '[01;34m*** Cleaning up installation...[00m'  	rm -rf ${DESTDIR}${LIBDIR}/hardinfo/modules ${DESTDIR}/usr/share/hardinfo/pixmaps -	@echo '[01;34m*** Creating directories...[00m'  	mkdir -p ${DESTDIR}/usr/bin  	mkdir -p ${DESTDIR}/usr/local  	mkdir -p ${DESTDIR}/usr/share/applications -	 -  	mkdir -p ${DESTDIR}${LIBDIR}/hardinfo/modules  	mkdir -p ${DESTDIR}/usr/share/hardinfo/pixmaps -	@echo '[01;34m*** Installing icon...[00m'  	cp hardinfo.desktop ${DESTDIR}/usr/share/applications -	@echo '[01;34m*** Installing executable...[00m'  	cp hardinfo ${DESTDIR}/usr/bin/hardinfo -	@echo '[01;34m*** Installing modules...[00m'  	cp -Lvr modules/*.so ${DESTDIR}${LIBDIR}/hardinfo/modules -	@echo '[01;34m*** Installing pixmaps...[00m'  	cp -Lvr pixmaps/* ${DESTDIR}/usr/share/hardinfo/pixmaps -	@echo '[01;34m*** Installing misc data...[00m'  	cp benchmark.conf ${DESTDIR}/usr/share/hardinfo  	cp benchmark.data ${DESTDIR}/usr/share/hardinfo -	@echo '[01;34m*** Fixing permissions...[00m'  	chmod 755 ${DESTDIR}/usr/bin/hardinfo -	@echo '[01;34m*** Done installing.[00m' -  installer:  	makepackage diff --git a/hardinfo2/arch/common/languages.h b/hardinfo2/arch/common/languages.h index 45eb2b6a..c1839ee9 100644 --- a/hardinfo2/arch/common/languages.h +++ b/hardinfo2/arch/common/languages.h @@ -40,7 +40,7 @@ scan_languages(OperatingSystem * os)      while (fgets(buf, 512, locale)) {  	if (!strncmp(buf, "locale:", 7)) {  	    sscanf(buf, "locale: %s", name); -	    fgets(buf, 128, locale); +	    (void)fgets(buf, 128, locale);  	} else if (strchr(buf, '|')) {  	    gchar **tmp = g_strsplit(buf, "|", 2); diff --git a/hardinfo2/arch/linux/common/alsa.h b/hardinfo2/arch/linux/common/alsa.h index 5609471c..ddd58edd 100644 --- a/hardinfo2/arch/linux/common/alsa.h +++ b/hardinfo2/arch/linux/common/alsa.h @@ -60,7 +60,7 @@ computer_get_alsainfo(void)  	ai->cards = g_slist_append(ai->cards, ac);  	g_strfreev(tmp); -	fgets(buffer, 128, cards);	/* skip next line */ +	(void)fgets(buffer, 128, cards);	/* skip next line */      }      fclose(cards); diff --git a/hardinfo2/arch/linux/common/battery.h b/hardinfo2/arch/linux/common/battery.h index 7dfa5423..d378fdef 100644 --- a/hardinfo2/arch/linux/common/battery.h +++ b/hardinfo2/arch/linux/common/battery.h @@ -217,7 +217,7 @@ __scan_battery_apm(void)      if ((procapm = fopen("/proc/apm", "r"))) {          int old_percentage = percentage; -        fscanf(procapm, "%s %s %s 0x%x %s %s %d%%", +        (void)fscanf(procapm, "%s %s %s 0x%x %s %s %d%%",                 apm_drv_ver, apm_bios_ver, trash,                 &ac_bat, trash, trash, &percentage);          fclose(procapm); diff --git a/hardinfo2/arch/linux/common/dmi.h b/hardinfo2/arch/linux/common/dmi.h index f69fdc21..34904ae5 100644 --- a/hardinfo2/arch/linux/common/dmi.h +++ b/hardinfo2/arch/linux/common/dmi.h @@ -70,7 +70,7 @@ gboolean dmi_get_info_dmidecode()        if ((dmi_pipe = popen(temp, "r"))) {          g_free(temp); -        fgets(buffer, 256, dmi_pipe); +        (void)fgets(buffer, 256, dmi_pipe);          if (pclose(dmi_pipe)) {            dmi_failed = TRUE;            break; @@ -120,7 +120,7 @@ gboolean dmi_get_info_sys()          continue;        if ((dmi_file = fopen(info->file, "r"))) { -        fgets(buffer, 256, dmi_file); +        (void)fgets(buffer, 256, dmi_file);          fclose(dmi_file);          dmi_info = h_strdup_cprintf("%s=%s\n", diff --git a/hardinfo2/arch/linux/common/loadavg.h b/hardinfo2/arch/linux/common/loadavg.h index 7c028679..ce2d8775 100644 --- a/hardinfo2/arch/linux/common/loadavg.h +++ b/hardinfo2/arch/linux/common/loadavg.h @@ -23,7 +23,7 @@ computer_get_loadinfo(void)      FILE *procloadavg;      procloadavg = fopen("/proc/loadavg", "r"); -    fscanf(procloadavg, "%f %f %f", &(li->load1), &(li->load5), +    (void)fscanf(procloadavg, "%f %f %f", &(li->load1), &(li->load5),  	   &(li->load15));      fclose(procloadavg); diff --git a/hardinfo2/arch/linux/common/modules.h b/hardinfo2/arch/linux/common/modules.h index 7ea238b7..78fb9de3 100644 --- a/hardinfo2/arch/linux/common/modules.h +++ b/hardinfo2/arch/linux/common/modules.h @@ -56,7 +56,7 @@ scan_modules_do(void)  	return;      } -    fgets(buffer, 1024, lsmod);	/* Discards the first line */ +    (void)fgets(buffer, 1024, lsmod);	/* Discards the first line */      while (fgets(buffer, 1024, lsmod)) {  	gchar *buf, *strmodule, *hashkey; diff --git a/hardinfo2/arch/linux/common/os.h b/hardinfo2/arch/linux/common/os.h index 01853123..cb90ea12 100644 --- a/hardinfo2/arch/linux/common/os.h +++ b/hardinfo2/arch/linux/common/os.h @@ -53,7 +53,7 @@ get_libc_version(void)      libc = popen("/lib/libc.so.6", "r");      if (!libc) goto err; -    fgets(buf, 256, libc); +    (void)fgets(buf, 256, libc);      if (pclose(libc)) goto err;      tmp = strstr(buf, "version "); @@ -80,7 +80,7 @@ get_os_compiled_date(void)      if (!procversion)  	return g_strdup("Unknown"); -    fgets(buf, 512, procversion); +    (void)fgets(buf, 512, procversion);      fclose(procversion);      return g_strdup(buf); @@ -103,7 +103,7 @@ detect_desktop_environment(OperatingSystem * os)  	   obtain the version. */  	version = popen("gnome-about --gnome-version", "r");  	if (version) { -	    fscanf(version, "Version: %s", vers); +	    (void)fscanf(version, "Version: %s", vers);  	    if (pclose(version))  	        goto unknown;  	} else { @@ -116,9 +116,9 @@ detect_desktop_environment(OperatingSystem * os)  	if (version) {  	    char buf[32]; -	    fgets(buf, 32, version); +	    (void)fgets(buf, 32, version); -	    fscanf(version, "KDE: %s", vers); +	    (void)fscanf(version, "KDE: %s", vers);  	    if (pclose(version))  	        goto unknown;  	} else { @@ -172,7 +172,7 @@ computer_get_os(void)  	release = popen("lsb_release -d", "r");  	if (release) { -            fgets(buffer, 128, release); +            (void)fgets(buffer, 128, release);              pclose(release);              os->distro = buffer; @@ -192,7 +192,7 @@ computer_get_os(void)  	    char buf[128];  	    distro_ver = fopen(distro_db[i].file, "r"); -	    fgets(buf, 128, distro_ver); +	    (void)fgets(buf, 128, distro_ver);  	    fclose(distro_ver);  	    buf[strlen(buf) - 1] = 0; diff --git a/hardinfo2/arch/linux/common/pci.h b/hardinfo2/arch/linux/common/pci.h index a1ea1021..73d87c7f 100644 --- a/hardinfo2/arch/linux/common/pci.h +++ b/hardinfo2/arch/linux/common/pci.h @@ -33,7 +33,7 @@ __scan_pci(void)  {      FILE *lspci;      gchar buffer[256], *buf, *strhash = NULL, *strdevice = NULL; -    gchar *category = NULL, *name = NULL, *icon, *lspci_path, *command_line; +    gchar *category = NULL, *name = NULL, *icon, *lspci_path, *command_line = NULL;      gint n = 0, x = 0;      if ((lspci_path = find_program("lspci")) == NULL) { diff --git a/hardinfo2/arch/linux/common/storage.h b/hardinfo2/arch/linux/common/storage.h index 5208f028..06593a09 100644 --- a/hardinfo2/arch/linux/common/storage.h +++ b/hardinfo2/arch/linux/common/storage.h @@ -180,7 +180,7 @@ __scan_ide_devices(void)  	    cache = 0;  	    proc_ide = fopen(device, "r"); -	    fgets(buf, 128, proc_ide); +	    (void)fgets(buf, 128, proc_ide);  	    fclose(proc_ide);  	    buf[strlen(buf) - 1] = 0; @@ -191,7 +191,7 @@ __scan_ide_devices(void)  	    device = g_strdup_printf("/proc/ide/hd%c/media", iface);  	    proc_ide = fopen(device, "r"); -	    fgets(buf, 128, proc_ide); +	    (void)fgets(buf, 128, proc_ide);  	    fclose(proc_ide);  	    buf[strlen(buf) - 1] = 0; @@ -257,7 +257,7 @@ __scan_ide_devices(void)  	    device = g_strdup_printf("/proc/ide/hd%c/cache", iface);  	    if (g_file_test(device, G_FILE_TEST_EXISTS)) {  		proc_ide = fopen(device, "r"); -		fscanf(proc_ide, "%d", &cache); +		(void)fscanf(proc_ide, "%d", &cache);  		fclose(proc_ide);  	    }  	    g_free(device); @@ -268,7 +268,7 @@ __scan_ide_devices(void)  		proc_ide = fopen(device, "r"); -		fgets(buf, 64, proc_ide); +		(void)fgets(buf, 64, proc_ide);  		for (tmp = buf; *tmp; tmp++) {  		    if (*tmp >= '0' && *tmp <= '9')  			break; @@ -276,7 +276,7 @@ __scan_ide_devices(void)  		pgeometry = g_strdup(g_strstrip(tmp)); -		fgets(buf, 64, proc_ide); +		(void)fgets(buf, 64, proc_ide);  		for (tmp = buf; *tmp; tmp++) {  		    if (*tmp >= '0' && *tmp <= '9')  			break; diff --git a/hardinfo2/arch/linux/common/uptime.h b/hardinfo2/arch/linux/common/uptime.h index b2412cd2..8fdc3a27 100644 --- a/hardinfo2/arch/linux/common/uptime.h +++ b/hardinfo2/arch/linux/common/uptime.h @@ -24,7 +24,7 @@ computer_get_uptime(void)      gulong minutes;      if ((procuptime = fopen("/proc/uptime", "r")) != NULL) { -	fscanf(procuptime, "%lu", &minutes); +	(void)fscanf(procuptime, "%lu", &minutes);  	ui->minutes = minutes / 60;  	fclose(procuptime);      } else { diff --git a/hardinfo2/network.c b/hardinfo2/network.c index 52029598..026386ec 100644 --- a/hardinfo2/network.c +++ b/hardinfo2/network.c @@ -178,8 +178,8 @@ void scan_route(gboolean reload)        if ((route = popen(command_line, "r"))) {          /* eat first two lines */ -        fgets(buffer, 256, route); -        fgets(buffer, 256, route); +        (void)fgets(buffer, 256, route); +        (void)fgets(buffer, 256, route);          while (fgets(buffer, 256, route)) {            buffer[15] = '\0'; @@ -218,7 +218,7 @@ void scan_arp(gboolean reload)      if ((arp = fopen("/proc/net/arp", "r"))) {        /* eat first line */ -      fgets(buffer, 256, arp); +      (void)fgets(buffer, 256, arp);        while (fgets(buffer, 256, arp)) {          buffer[15] = '\0'; diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c index 376f1034..fe95c87f 100644 --- a/hardinfo2/shell.c +++ b/hardinfo2/shell.c @@ -846,7 +846,7 @@ group_handle_special(GKeyFile * key_file, ShellModuleEntry * entry,  	    } else if (g_str_equal(key, "ShowColumnHeaders")) {  		headers_visible = g_key_file_get_boolean(key_file, group, key, NULL);  	    } else if (g_str_has_prefix(key, "ColumnTitle")) { -                GtkTreeViewColumn *column; +                GtkTreeViewColumn *column = NULL;  		gchar *value, *title = strchr(key, '$') + 1;                  value = g_key_file_get_value(key_file, group, key, NULL); @@ -863,8 +863,10 @@ group_handle_special(GKeyFile * key_file, ShellModuleEntry * entry,  			column = shell->info->col_progress;                  } -                gtk_tree_view_column_set_title(column, value); -                gtk_tree_view_column_set_visible(column, TRUE); +                if (column) { +                  gtk_tree_view_column_set_title(column, value); +                  gtk_tree_view_column_set_visible(column, TRUE); +                }                  g_free(value);  	    } else if (g_str_equal(key, "OrderType")) { | 
