From b0ca086f7b98cdb92355c7adfddd3d976b7c94fc Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Sun, 3 Apr 2011 20:59:34 +0200 Subject: hdt: Making dumping code easier to use A set of CREATE_NEW_OBJECT / FLUSH is enough for a simple dump. --- com32/hdt/hdt-dump-pci.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'com32/hdt/hdt-dump-pci.c') diff --git a/com32/hdt/hdt-dump-pci.c b/com32/hdt/hdt-dump-pci.c index 9d89f3ad..b1f18fdf 100644 --- a/com32/hdt/hdt-dump-pci.c +++ b/com32/hdt/hdt-dump-pci.c @@ -54,10 +54,11 @@ void dump_pci(struct s_hardware *hardware, ZZJSON_CONFIG * config, nomodulesfile = nomodulespcimap && nomodulesalias; - *item = zzjson_create_object(config, NULL); /* empty object */ + CREATE_NEW_OBJECT; add_i("pci_device.count", hardware->nb_pci_devices); + FLUSH_OBJECT; /* For every detected pci device, compute its submenu */ for_each_pci_func(pci_device, hardware->pci_domain) { if (pci_device == NULL) @@ -69,9 +70,7 @@ void dump_pci(struct s_hardware *hardware, ZZJSON_CONFIG * config, char c[10] = { 0 }; char r[10] = { 0 }; - zzjson_print(config, *item); - zzjson_free(config, *item); - *item = zzjson_create_object(config, NULL); /* empty object */ + CREATE_NEW_OBJECT; bus = __pci_bus; slot = __pci_slot; func = __pci_func; @@ -112,8 +111,8 @@ void dump_pci(struct s_hardware *hardware, ZZJSON_CONFIG * config, add_s("pci_device.product_id", p); add_s("pci_device.sub_vendor_id", sv); add_s("pci_device.sub_product_id", sp); -// add_s("pci_device.class_id", c); -// add_s("pci_device.revision", r); + add_s("pci_device.class_id", c); + add_s("pci_device.revision", r); if ((pci_device->dev_info->irq > 0) && (pci_device->dev_info->irq < 255)) add_i("pci_device.irq", pci_device->dev_info->irq); @@ -131,6 +130,7 @@ void dump_pci(struct s_hardware *hardware, ZZJSON_CONFIG * config, } } i++; + FLUSH_OBJECT; } - flush("pci", config, item); + to_cpio("pci"); } -- cgit v1.2.1