aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2006-11-26 14:13:13 +0000
committerLeandro A. F. Pereira <leandro@hardinfo.org>2006-11-26 14:13:13 +0000
commite39038e95cbcc52fe95039e8229e0dd98d86ade9 (patch)
tree8b94a46fc16fc1f036dc28b2a7c23c2250518712 /hardinfo2
parentccd5ecd04700586b66f68753c8a3bf2f1e19aa39 (diff)
Fix segfault; cleanups
Diffstat (limited to 'hardinfo2')
-rw-r--r--hardinfo2/arch/common/display.h18
-rwxr-xr-xhardinfo2/configure2
-rw-r--r--hardinfo2/shell.c6
3 files changed, 12 insertions, 14 deletions
diff --git a/hardinfo2/arch/common/display.h b/hardinfo2/arch/common/display.h
index b28d34cc..7bab4b50 100644
--- a/hardinfo2/arch/common/display.h
+++ b/hardinfo2/arch/common/display.h
@@ -21,15 +21,14 @@ get_glx_info(DisplayInfo *di)
{
gchar *output;
if (g_spawn_command_line_sync("glxinfo", &output, NULL, NULL, NULL)) {
- gchar **output_lines, **old;
+ gchar **output_lines;
+ gint i = 0;
- output_lines = g_strsplit(output, "\n", 0);
- g_free(output);
-
- old = output_lines;
- while (*(++output_lines)) {
- if (strstr(*output_lines, "OpenGL")) {
- gchar **tmp = g_strsplit(*output_lines, ":", 0);
+ for (output_lines = g_strsplit(output, "\n", 0);
+ output_lines && output_lines[i];
+ i++) {
+ if (strstr(output_lines[i], "OpenGL")) {
+ gchar **tmp = g_strsplit(output_lines[i], ":", 0);
tmp[1] = g_strchug(tmp[1]);
@@ -41,7 +40,8 @@ get_glx_info(DisplayInfo *di)
}
}
- g_strfreev(old);
+ g_free(output);
+ g_strfreev(output_lines);
if (!di->ogl_vendor)
di->ogl_vendor = "Unknown";
diff --git a/hardinfo2/configure b/hardinfo2/configure
index 869541ea..a9d90300 100755
--- a/hardinfo2/configure
+++ b/hardinfo2/configure
@@ -201,6 +201,6 @@ else
cat << EOF
If you get errors, probably you don't have the right libraries,
includes or utilities. However, if you're sure this is a bug in my
-code, please send a patch (use \"diff -u\") to <leandro@linuxmag.com.br>.
+code, please send a patch (use "diff -u") to <leandro@linuxmag.com.br>.
EOF
fi
diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c
index d18ecdba..aa616d56 100644
--- a/hardinfo2/shell.c
+++ b/hardinfo2/shell.c
@@ -216,16 +216,14 @@ shell_status_set_percentage(gint percentage)
while (gtk_events_pending())
gtk_main_iteration();
} else {
- gchar i, j = percentage / 10;
+ gchar j = percentage / 10;
if (percentage < 1 || j >= 10) {
fprintf(stderr, "\033[2K");
} else {
gchar bar[] = "----------";
-
- for (i = 0; i < j; i++)
- bar[i] = '#';
+ memset(bar, '#', j);
fprintf(stderr, "\r\033[40;37;1m%3d%% \033[40;34;1m"
"%s\033[0m\r", percentage, bar);
}