Convert alloc+sprintf pairs into asprintf() & XNFasprintf() calls

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
This commit is contained in:
Alan Coopersmith 2010-11-27 22:38:27 -08:00
commit 3a9bb93dd1
11 changed files with 36 additions and 62 deletions

View file

@ -2426,13 +2426,10 @@ DRICreatePCIBusID(const struct pci_device * dev)
{
char *busID;
busID = malloc(20);
if (busID == NULL)
if (asprintf(&busID, "pci:%04x:%02x:%02x.%d",
dev->domain, dev->bus, dev->dev, dev->func) == -1)
return NULL;
snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus,
dev->dev, dev->func);
return busID;
}