X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lspci.c;h=b2ce10476ecdf108b4b9090eb9da395ea33213b9;hb=2c83b8606c4b50d40356d6b96d15c289a13cbce4;hp=77e0786891143a4eeea2b173193c60146bcccc06;hpb=2715403f3b3185776d4bedd912e5524e0b78ba87;p=pciutils.git diff --git a/lspci.c b/lspci.c index 77e0786..b2ce104 100644 --- a/lspci.c +++ b/lspci.c @@ -1,5 +1,5 @@ /* - * $Id: lspci.c,v 1.34 2000/01/20 21:23:14 mj Exp $ + * $Id: lspci.c,v 1.36 2000/04/21 11:58:00 mj Exp $ * * Linux PCI Utilities -- List All PCI Devices * @@ -74,6 +74,16 @@ static struct pci_access *pacc; #define IO_FORMAT "%04lx" #endif +/* + * If we aren't being compiled by GCC, use malloc() instead of alloca(). + * This increases our memory footprint, but only slightly since we don't + * use alloca() much. + */ + +#ifndef __GNUC__ +#define alloca malloc +#endif + /* Our view of the PCI bus */ struct device { @@ -399,7 +409,7 @@ format_agp_rate(int rate, char *buf) if (c != buf) *c++ = ','; *c++ = 'x'; - *c++ = '0' + (4 >> i); + *c++ = '0' + (1 << i); } if (c != buf) *c = 0; @@ -1006,7 +1016,10 @@ insert_dev(struct device *d, struct bridge *b) struct bridge *c; for(c=b->child; c; c=c->next) if (c->secondary <= p->bus && p->bus <= c->subordinate) - return insert_dev(d, c); + { + insert_dev(d, c); + return; + } bus = new_bus(b, p->bus); } /* Simple insertion at the end _does_ guarantee the correct order as the