From 52b133d9d7fb007075f05b8289be517db6574fd3 Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Sat, 30 Jun 2007 14:32:22 +0000 Subject: Plug memleaks. Cleanups. --- hardinfo2/arch/common/printers.h | 18 ++++-- hardinfo2/arch/linux/common/inputdevices.h | 10 ++-- hardinfo2/arch/linux/common/modules.h | 2 +- hardinfo2/arch/linux/x86/processor.h | 4 +- hardinfo2/computer.c | 2 +- hardinfo2/shell.c | 6 +- hardinfo2/uidefs.h | 89 +++++++++++++++--------------- 7 files changed, 70 insertions(+), 61 deletions(-) (limited to 'hardinfo2') diff --git a/hardinfo2/arch/common/printers.h b/hardinfo2/arch/common/printers.h index 3daf28e6..7cf72384 100644 --- a/hardinfo2/arch/common/printers.h +++ b/hardinfo2/arch/common/printers.h @@ -68,14 +68,22 @@ __scan_printers(void) } if (noprinters > 0) { - printer_list = g_strdup_printf("[Printers (CUPS)]\n"); + printer_list = g_strdup_printf("[$ShellParam$]\n" + "ViewType=1\n" + "[Printers (CUPS)]\n"); for (i = 0; i < noprinters; i++) { - printer_list = g_strconcat(printer_list, printers[i], - g_str_equal(default_printer, printers[i]) ? - "=(Default)\n" : "=\n", - NULL); + printer_list = g_strdup_printf("%s\n" + "$PRN%d$" + "%s=%s\n", + (char*)idle_free(printer_list), + i, + printers[i], + g_str_equal(default_printer, printers[i]) ? + "(Default)" : ""); g_free(printers[i]); } + + g_free(printers); } else { printer_list = g_strdup("[Printers]\n" "No printers found=\n"); diff --git a/hardinfo2/arch/linux/common/inputdevices.h b/hardinfo2/arch/linux/common/inputdevices.h index a7102335..28611f32 100644 --- a/hardinfo2/arch/linux/common/inputdevices.h +++ b/hardinfo2/arch/linux/common/inputdevices.h @@ -88,10 +88,10 @@ __scan_input_devices(void) tmp = g_strdup_printf("INP%d", ++n); input_list = g_strdup_printf("%s$%s$%s=\n", - input_list, + (char*)idle_free(input_list), tmp, name); input_icons = g_strdup_printf("%sIcon$%s$%s=%s\n", - input_icons, + (char*)idle_free(input_icons), tmp, name, input_devices[d].icon); gchar *strhash = g_strdup_printf("[Device Information]\n" @@ -106,13 +106,13 @@ __scan_input_devices(void) if (url) { strhash = g_strdup_printf("%s" "Vendor=%s (%s)\n", - strhash, + (char*)idle_free(strhash), vendor_get_name(name), url); } else { strhash = g_strdup_printf("%s" "Vendor=%x\n", - strhash, + (char*)idle_free(strhash), vendor); } @@ -120,7 +120,7 @@ __scan_input_devices(void) "Product=0x%x\n" "Version=0x%x\n" "Connected to=%s\n", - strhash, product, version, phys); + (char*)idle_free(strhash), product, version, phys); g_hash_table_insert(moreinfo, tmp, strhash); g_free(phys); diff --git a/hardinfo2/arch/linux/common/modules.h b/hardinfo2/arch/linux/common/modules.h index 54e77ddb..bbde818a 100644 --- a/hardinfo2/arch/linux/common/modules.h +++ b/hardinfo2/arch/linux/common/modules.h @@ -99,7 +99,7 @@ scan_modules_do(void) /* append this module to the list of modules */ module_list = g_strdup_printf("%s$%s$%s=%s\n", - module_list ? module_list : "", + module_list ? (char*)idle_free(module_list) : "", hashkey, modname, description ? description : ""); diff --git a/hardinfo2/arch/linux/x86/processor.h b/hardinfo2/arch/linux/x86/processor.h index 918bac7c..2aa2f8af 100644 --- a/hardinfo2/arch/linux/x86/processor.h +++ b/hardinfo2/arch/linux/x86/processor.h @@ -279,7 +279,7 @@ gchar *processor_get_capabilities_from_flags(gchar * strflags) } } - tmp = g_strdup_printf("%s%s=%s\n", tmp, flags[j], meaning); + tmp = g_strdup_printf("%s%s=%s\n", (gchar*)idle_free(tmp), flags[j], meaning); j++; } @@ -347,7 +347,7 @@ static gchar *processor_get_info(GSList * processors) processor = (Processor *) l->data; tmp = g_strdup_printf("%s$CPU%d$%s=%.2fMHz\n", - tmp, processor->id, + (gchar*)idle_free(tmp), processor->id, processor->model_name, processor->cpu_mhz); diff --git a/hardinfo2/computer.c b/hardinfo2/computer.c index cf20c6d6..8679ffb6 100644 --- a/hardinfo2/computer.c +++ b/hardinfo2/computer.c @@ -406,7 +406,7 @@ void hi_module_init(void) { computer = g_new0(Computer, 1); - moreinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + moreinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); } ModuleAbout * diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c index 6d4d469d..db9f15a1 100644 --- a/hardinfo2/shell.c +++ b/hardinfo2/shell.c @@ -365,14 +365,14 @@ static void create_window(void) gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 3); shell->progress = gtk_progress_bar_new(); - gtk_widget_set_size_request(shell->progress, 70, 10); + gtk_widget_set_size_request(shell->progress, 80, 10); gtk_widget_hide(shell->progress); - gtk_box_pack_end(GTK_BOX(hbox), shell->progress, FALSE, FALSE, 0); + gtk_box_pack_end(GTK_BOX(hbox), shell->progress, FALSE, FALSE, 5); shell->status = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(shell->status), 0.0, 0.5); gtk_widget_show(shell->status); - gtk_box_pack_start(GTK_BOX(hbox), shell->status, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), shell->status, FALSE, FALSE, 5); shell->hpaned = gtk_hpaned_new(); gtk_widget_show(shell->hpaned); diff --git a/hardinfo2/uidefs.h b/hardinfo2/uidefs.h index 75549f35..591ecd01 100644 --- a/hardinfo2/uidefs.h +++ b/hardinfo2/uidefs.h @@ -2,49 +2,50 @@ #define __UIDEFS_H__ char *uidefs_str = "" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -""; +" " \ +" " \ +" " \ +" " \ +" " \ +/* + * Save Image is not ready for prime time. Yet. + * "" \ + */ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +""; #endif /* __UIDEFS_H__ */ -- cgit v1.2.3