]> mj.ucw.cz Git - pciutils.git/commitdiff
Get rid of bzero().
authorMartin Mares <mj@ucw.cz>
Tue, 6 Feb 2007 12:02:08 +0000 (13:02 +0100)
committerMartin Mares <mj@ucw.cz>
Tue, 6 Feb 2007 12:02:08 +0000 (13:02 +0100)
ChangeLog
lib/access.c
lib/aix-device.c
lib/generic.c
lib/names.c
lib/sysdep.h
lspci.c

index 3ebadcf9849550caec75f39d7a67e50c0d471911..5d82f1893a10d52262fd518d1435c8ecb170790f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-02-06  Martin Mares  <mj@ucw.cz>
 
+       * Replaced bzero() by memset() everywhere, it's better to lose a tiny
+       bit of readability than maintain hacks to make it work on various systems.
+
        * lib/configure: tr on Solaris is a bit weird and it requires `[A-Z]'
        instead of `A-Z'. Fortunately, the extra brackets don't hurt otherwise.
 
index 7e3fb71b1a7d548e96809cd7f5c4c87a4ba8f1f0..d4999d6d4184dd61b015f447ef91891d4204c9f9 100644 (file)
@@ -65,7 +65,7 @@ pci_alloc(void)
   struct pci_access *a = malloc(sizeof(struct pci_access));
   int i;
 
-  bzero(a, sizeof(*a));
+  memset(a, 0, sizeof(*a));
   pci_set_name_list_path(a, PCI_PATH_IDS_DIR "/" PCI_IDS, 0);
   for(i=0; i<PCI_ACCESS_MAX; i++)
     if (pci_methods[i] && pci_methods[i]->config)
@@ -197,7 +197,7 @@ pci_alloc_dev(struct pci_access *a)
 {
   struct pci_dev *d = pci_malloc(a, sizeof(struct pci_dev));
 
-  bzero(d, sizeof(*d));
+  memset(d, 0, sizeof(*d));
   d->access = a;
   d->methods = a->methods;
   d->hdrtype = -1;
index 2c6a2ccf676f8f89e0fdc2e4fd142bb65785f9a5..e02c98dc4cd647597d0dfe20c760b4ea1c40e385 100644 (file)
@@ -207,7 +207,7 @@ aix_scan(struct pci_access *a)
   int bus_number;
   byte busmap[256];
 
-  bzero(busmap, sizeof(busmap));
+  memset(busmap, 0, sizeof(busmap));
   for (i = 0; i < pci_bus_count; i++)
     {
       bus_number = pci_buses[i].bus_number;
index b1b1c8ed01a32e329d8681beec4038125f2697e1..617c5fe838c4415c52a153cc8d3daf54e10192b0 100644 (file)
@@ -70,7 +70,7 @@ pci_generic_scan(struct pci_access *a)
 {
   byte busmap[256];
 
-  bzero(busmap, sizeof(busmap));
+  memset(busmap, 0, sizeof(busmap));
   pci_generic_scan_bus(a, busmap, 0);
 }
 
@@ -93,7 +93,7 @@ pci_generic_fill_info(struct pci_dev *d, int flags)
   if (flags & PCI_FILL_BASES)
     {
       int cnt = 0, i;
-      bzero(d->base_addr, sizeof(d->base_addr));
+      memset(d->base_addr, 0, sizeof(d->base_addr));
       switch (d->hdrtype)
        {
        case PCI_HEADER_TYPE_NORMAL:
index c1b3081c0915810126457f41addba4402e75d25d..6d671d102f6653c5408122f4ef7e2afa4ba659ca 100644 (file)
@@ -326,7 +326,7 @@ pci_load_name_list(struct pci_access *a)
   if (!(f = pci_open(a)))
     return 0;
   a->id_hash = pci_malloc(a, sizeof(struct id_entry *) * HASH_SIZE);
-  bzero(a->id_hash, sizeof(struct id_entry *) * HASH_SIZE);
+  memset(a->id_hash, 0, sizeof(struct id_entry *) * HASH_SIZE);
   err = id_parse_list(a, f, &lino);
   PCI_ERROR(f, err);
   pci_close(f);
index a54222f6bb1f8023706695874193b2734f811e04..2a25c9356c2d70aefcab357d92fd2d93764e70f4 100644 (file)
@@ -19,7 +19,6 @@ typedef u8 byte;
 typedef u16 word;
 
 #ifdef PCI_OS_WINDOWS
-#define bzero(x,y) memset(x,0,y)
 #define strcasecmp strcmpi
 #endif
 
diff --git a/lspci.c b/lspci.c
index 9c6a0c2f669b73096f5fde4bb947dd6d15ca81e7..5c1238353feaf21fab65954bd229ac3e203932e6 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -99,7 +99,7 @@ config_fetch(struct device *d, unsigned int pos, unsigned int len)
        d->config_bufsize *= 2;
       d->config = xrealloc(d->config, d->config_bufsize);
       d->present = xrealloc(d->present, d->config_bufsize);
-      bzero(d->present + orig_size, d->config_bufsize - orig_size);
+      memset(d->present + orig_size, 0, d->config_bufsize - orig_size);
     }
   result = pci_read_block(d->dev, pos, d->config + pos, len);
   if (result)
@@ -117,7 +117,7 @@ scan_device(struct pci_dev *p)
   if (!pci_filter_match(&filter, p))
     return NULL;
   d = xmalloc(sizeof(struct device));
-  bzero(d, sizeof(*d));
+  memset(d, 0, sizeof(*d));
   d->dev = p;
   d->config_cached = d->config_bufsize = 64;
   d->config = xmalloc(64);
@@ -2316,7 +2316,7 @@ map_the_bus(void)
       pacc->method == PCI_ACCESS_DUMP)
     printf("WARNING: Bus mapping can be reliable only with direct hardware access enabled.\n\n");
   bus_info = xmalloc(sizeof(struct bus_info) * 256);
-  bzero(bus_info, sizeof(struct bus_info) * 256);
+  memset(bus_info, 0, sizeof(struct bus_info) * 256);
   if (filter.bus >= 0)
     do_map_bus(filter.bus);
   else