From afa9757a0e7c15a7e41de872e0f540a67a8e2d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Tue, 4 Apr 2006 21:23:46 +0000 Subject: [PATCH] Store only strings in values' values. g_strdup these strings. Even if MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2006-04-04 Benoît Dejean * sysinfo.c: (init_sysinfo): Store only strings in values' values. g_strdup these strings. Even if values is never destroyed, set key_destroy_func to NULL. Leave description to NULL. --- sysdeps/freebsd/ChangeLog | 9 +++++++++ sysdeps/freebsd/sysinfo.c | 14 ++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/sysdeps/freebsd/ChangeLog b/sysdeps/freebsd/ChangeLog index cb3b7a48..5bcd3241 100644 --- a/sysdeps/freebsd/ChangeLog +++ b/sysdeps/freebsd/ChangeLog @@ -1,3 +1,12 @@ +2006-04-04 Benoît Dejean + + * sysinfo.c: (init_sysinfo): + + Store only strings in values' values. g_strdup these strings. + Even if values is never destroyed, set key_destroy_func to NULL. + + Leave description to NULL. + 2006-04-04 Julio M. Merino Vidal * sysdeps/freebsd/Makefile.am: diff --git a/sysdeps/freebsd/sysinfo.c b/sysdeps/freebsd/sysinfo.c index 8a44167b..10cbd6f3 100644 --- a/sysdeps/freebsd/sysinfo.c +++ b/sysdeps/freebsd/sysinfo.c @@ -63,21 +63,19 @@ init_sysinfo (glibtop *server) cpuinfo->values = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - cpuinfo->descriptions = g_hash_table_new_full(g_str_hash, - g_str_equal, - g_free, g_free); + NULL, g_free); g_ptr_array_add (cpuinfo->labels, "processor"); g_hash_table_insert (cpuinfo->values, "processor", - &sysinfo.ncpu); + g_strdup_printf("%u", (guint)sysinfo.ncpu)); g_ptr_array_add (cpuinfo->labels, "vendor_id"); - g_hash_table_insert (cpuinfo->values, "vendor_id", model); + g_hash_table_insert (cpuinfo->values, "vendor_id", + g_strdup(model)); g_ptr_array_add (cpuinfo->labels, "cpu MHz"); - g_hash_table_insert (cpuinfo->values, "cpu MHz", &mhz); + g_hash_table_insert (cpuinfo->values, "cpu MHz", + g_strdup_printf("%d", mhz)); } g_free (model);