diff options
Diffstat (limited to 'modules/devices')
| -rw-r--r-- | modules/devices/devmemory.c | 2 | ||||
| -rw-r--r-- | modules/devices/dmi.c | 2 | ||||
| -rw-r--r-- | modules/devices/inputdevices.c | 11 | ||||
| -rw-r--r-- | modules/devices/pci.c | 6 | ||||
| -rw-r--r-- | modules/devices/printers.c | 11 | ||||
| -rw-r--r-- | modules/devices/spd-decode.c | 4 | ||||
| -rw-r--r-- | modules/devices/storage.c | 22 | ||||
| -rw-r--r-- | modules/devices/usb.c | 22 | ||||
| -rw-r--r-- | modules/devices/x86/processor.c | 3 | 
9 files changed, 32 insertions, 51 deletions
| diff --git a/modules/devices/devmemory.c b/modules/devices/devmemory.c index 8c89d567..31fd8915 100644 --- a/modules/devices/devmemory.c +++ b/modules/devices/devmemory.c @@ -64,7 +64,7 @@ void scan_memory_do(void)              newkeys[0] = g_strdup(tmp);          } -        g_hash_table_replace(moreinfo, g_strdup(newkeys[0]), g_strdup(newkeys[1])); +        moreinfo_add_with_prefix("DEV", newkeys[0], g_strdup(newkeys[1]));          tmp = g_strconcat(meminfo, newkeys[0], "=", newkeys[1], "\n", NULL);          g_free(meminfo); diff --git a/modules/devices/dmi.c b/modules/devices/dmi.c index 9d54fa9c..9c6e3009 100644 --- a/modules/devices/dmi.c +++ b/modules/devices/dmi.c @@ -46,7 +46,7 @@ gchar *dmi_info = NULL;  static void add_to_moreinfo(const char *group, const char *key, char *value)  {    char *new_key = g_strconcat("DMI:", group, ":", key, NULL); -  g_hash_table_replace(moreinfo, new_key, g_strdup(g_strstrip(value))); +  moreinfo_add_with_prefix("DEV", new_key, g_strdup(g_strstrip(value)));  }  gboolean dmi_get_info_dmidecode() diff --git a/modules/devices/inputdevices.c b/modules/devices/inputdevices.c index 31f51fbb..5ff415cf 100644 --- a/modules/devices/inputdevices.c +++ b/modules/devices/inputdevices.c @@ -23,12 +23,6 @@  gchar *input_icons = NULL; -static gboolean -remove_input_devices(gpointer key, gpointer value, gpointer data) -{ -    return g_str_has_prefix(key, "INP"); -} -  static struct {      char *name;      char *icon; @@ -54,7 +48,7 @@ __scan_input_devices(void)  	return;      if (input_list) { -	g_hash_table_foreach_remove(moreinfo, remove_input_devices, NULL); +        moreinfo_del_with_prefix("DEV:INP");  	g_free(input_list);  	g_free(input_icons);      } @@ -133,7 +127,8 @@ __scan_input_devices(void)  				 	     strhash);  	    } -	    g_hash_table_insert(moreinfo, tmp, strhash); +	    moreinfo_add_with_prefix("DEV", tmp, strhash); +	    g_free(tmp);  	    g_free(phys);  	    g_free(name); diff --git a/modules/devices/pci.c b/modules/devices/pci.c index a8439019..91ff914d 100644 --- a/modules/devices/pci.c +++ b/modules/devices/pci.c @@ -166,7 +166,8 @@ scan_pci_do(void)  	    gpointer start, end;  	    if (strdevice != NULL && strhash != NULL) { -		g_hash_table_insert(moreinfo, strhash, strdevice); +                moreinfo_add_with_prefix("DEV", strhash, strdevice); +                g_free(strhash);                  g_free(category);                  g_free(name);  	    } @@ -235,7 +236,8 @@ pci_error:          pci_list = g_strconcat(pci_list, "No PCI devices found=\n", NULL);      } else if (strhash) {  	/* insert the last device */ -        g_hash_table_insert(moreinfo, strhash, strdevice); +        moreinfo_add_with_prefix("DEV", strhash, strdevice); +        g_free(strhash);          g_free(category);          g_free(name);      } diff --git a/modules/devices/printers.c b/modules/devices/printers.c index 80851a00..013291cf 100644 --- a/modules/devices/printers.c +++ b/modules/devices/printers.c @@ -42,12 +42,6 @@ static gboolean cups_init = FALSE;  GModule *cups; -static gboolean -remove_printer_devices(gpointer key, gpointer value, gpointer data) -{ -    return g_str_has_prefix(key, "PRN"); -} -  void  init_cups(void)  { @@ -199,7 +193,7 @@ scan_printers_do(void)      }      /* remove old devices from global device table */ -    g_hash_table_foreach_remove(moreinfo, remove_printer_devices, NULL); +    moreinfo_del_with_prefix("DEV:PRN");      num_dests = cups_dests_get(&dests);      if (num_dests > 0) { @@ -259,7 +253,8 @@ scan_printers_do(void)                }              } -            g_hash_table_insert(moreinfo, prn_id, prn_moreinfo); +            moreinfo_add_with_prefix("DEV", prn_id, prn_moreinfo); +            g_free(prn_id);              g_hash_table_destroy(options);  	} diff --git a/modules/devices/spd-decode.c b/modules/devices/spd-decode.c index bb22c1b7..d559555f 100644 --- a/modules/devices/spd-decode.c +++ b/modules/devices/spd-decode.c @@ -1295,7 +1295,9 @@ static gchar *decode_dimms(GSList *dimm_list, gboolean use_sysfs)          decode_module_manufacturer(bytes, &manufacturer);          decode_module_part_number(bytes, part_number); -        g_hash_table_insert(moreinfo, g_strdup_printf("MEM%d", count), g_strdup(detailed_info)); +        gchar *key = g_strdup_printf("MEM%d", count); +        moreinfo_add_with_prefix("DEV", key, g_strdup(detailed_info)); +        g_free(key);          g_string_append_printf(output,                                 "$MEM%d$%d=%s|%d MB|%s\n",                                 count, count, diff --git a/modules/devices/storage.c b/modules/devices/storage.c index a9dfd665..3df6c765 100644 --- a/modules/devices/storage.c +++ b/modules/devices/storage.c @@ -23,12 +23,6 @@  gchar *storage_icons = NULL; -static gboolean -remove_scsi_devices(gpointer key, gpointer value, gpointer data) -{ -    return g_str_has_prefix(key, "SCSI"); -} -  /* SCSI support by Pascal F.Martin <pascalmartin@earthlink.net> */  void  __scan_scsi_devices(void) @@ -44,7 +38,7 @@ __scan_scsi_devices(void)      gchar *scsi_storage_list;      /* remove old devices from global device table */ -    g_hash_table_foreach_remove(moreinfo, remove_scsi_devices, NULL); +    moreinfo_del_with_prefix("DEV:SCSI");      if (!g_file_test("/proc/scsi/scsi", G_FILE_TEST_EXISTS))  	return; @@ -141,7 +135,8 @@ __scan_scsi_devices(void)                                             scsi_channel,                                             scsi_id,                                             scsi_lun); -                g_hash_table_insert(moreinfo, devid, strhash); +                moreinfo_add_with_prefix("DEV", devid, strhash); +                g_free(devid);                  g_free(model);                  g_free(revision); @@ -159,12 +154,6 @@ __scan_scsi_devices(void)      }  } -static gboolean -remove_ide_devices(gpointer key, gpointer value, gpointer data) -{ -    return g_str_has_prefix(key, "IDE"); -} -  void  __scan_ide_devices(void)  { @@ -175,7 +164,7 @@ __scan_ide_devices(void)      gchar *capab = NULL, *speed = NULL, *driver = NULL, *ide_storage_list;      /* remove old devices from global device table */ -    g_hash_table_foreach_remove(moreinfo, remove_ide_devices, NULL); +    moreinfo_del_with_prefix("DEV:IDE");      ide_storage_list = g_strdup("\n[IDE Disks]\n"); @@ -362,7 +351,8 @@ __scan_ide_devices(void)                  speed = NULL;              } -	    g_hash_table_insert(moreinfo, devid, strhash); +           moreinfo_add_with_prefix("DEV", devid, strhash); +           g_free(devid);  	    g_free(model);  	    model = g_strdup(""); diff --git a/modules/devices/usb.c b/modules/devices/usb.c index a8868b1e..62fe258c 100644 --- a/modules/devices/usb.c +++ b/modules/devices/usb.c @@ -27,12 +27,6 @@  gchar *usb_list = NULL; -static gboolean -remove_usb_devices(gpointer key, gpointer value, gpointer data) -{ -    return g_str_has_prefix(key, "USB"); -} -  void __scan_usb_sysfs_add_device(gchar * endpoint, int n)  {      gchar *manufacturer, *product, *mxpwr, *tmp, *strhash; @@ -90,8 +84,8 @@ void __scan_usb_sysfs_add_device(gchar * endpoint, int n)  			      mxpwr,  			      version, classid, vendor, prodid, bus); -    g_hash_table_insert(moreinfo, tmp, strhash); - +    moreinfo_add_with_prefix("DEV", tmp, strhash); +    g_free(tmp);      g_free(manufacturer);      g_free(product);      g_free(mxpwr); @@ -109,7 +103,7 @@ gboolean __scan_usb_sysfs(void)      }      if (usb_list) { -	g_hash_table_foreach_remove(moreinfo, remove_usb_devices, NULL); +       moreinfo_del_with_prefix("DEV:USB");  	g_free(usb_list);      }      usb_list = g_strdup("[USB Devices]\n"); @@ -148,7 +142,7 @@ gboolean __scan_usb_procfs(void)  	return 0;      if (usb_list) { -	g_hash_table_foreach_remove(moreinfo, remove_usb_devices, NULL); +       moreinfo_del_with_prefix("DEV:USB");  	g_free(usb_list);      }      usb_list = g_strdup("[USB Devices]\n"); @@ -233,7 +227,8 @@ gboolean __scan_usb_procfs(void)  					   ver, rev, classid,  					   vendor, prodid, bus, level); -		g_hash_table_insert(moreinfo, tmp, strhash); +               moreinfo_add_with_prefix("DEV", tmp, strhash); +               g_free(tmp);  	    }  	    g_free(manuf); @@ -317,13 +312,14 @@ void __scan_usb_lsusb_add_device(char *buffer, FILE *lsusb, int usb_device_numbe  			      dev_class ? g_strstrip(dev_class) : "Unknown",  			      vendor_id, product_id, bus); -    g_hash_table_insert(moreinfo, tmp, strhash); +    moreinfo_add_with_prefix("DEV", tmp, strhash);      g_free(vendor);      g_free(product);      g_free(max_power);      g_free(dev_class);      g_free(version); +    g_free(tmp);  }  gboolean __scan_usb_lsusb(void) @@ -352,7 +348,7 @@ gboolean __scan_usb_lsusb(void)      g_free(temp);      if (usb_list) { -	g_hash_table_foreach_remove(moreinfo, remove_usb_devices, NULL); +       moreinfo_del_with_prefix("DEV:USB");  	g_free(usb_list);      }      usb_list = g_strdup("[USB Devices]\n"); diff --git a/modules/devices/x86/processor.c b/modules/devices/x86/processor.c index e70d1374..2609720e 100644 --- a/modules/devices/x86/processor.c +++ b/modules/devices/x86/processor.c @@ -545,8 +545,9 @@ gchar *processor_get_info(GSList * processors)  				  processor->cpu_mhz);  	    hashkey = g_strdup_printf("CPU%d", processor->id); -	    g_hash_table_insert(moreinfo, hashkey, +	    moreinfo_add_with_prefix("DEV", hashkey,  				processor_get_detailed_info(processor)); +           g_free(hashkey);  	}  	ret = g_strdup_printf("[$ShellParam$]\n" | 
