xf86-video-intel: src/intel_driver.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Dec 22 05:52:06 PST 2010


 src/intel_driver.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit 58d9912e447cf6e29b20747b5ed6ee595687ce8d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Dec 22 13:50:53 2010 +0000

    Remove the deprecated function 'XNFprintf'
    
    As we know the maximum length of the string, we can replace our single
    usage of XNFprintf with snprintf.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_driver.c b/src/intel_driver.c
index 962ee50..f09203a 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -354,26 +354,22 @@ static Bool intel_open_drm_master(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	struct pci_device *dev = intel->PciInfo;
-	char *busid;
 	drmSetVersion sv;
 	struct drm_i915_getparam gp;
 	int err, has_gem;
+	char busid[20];
 
-	/* We wish we had asprintf, but all we get is XNFprintf. */
-	busid = XNFprintf("pci:%04x:%02x:%02x.%d",
-			  dev->domain, dev->bus, dev->dev, dev->func);
+	snprintf(busid, sizeof(busid), "pci:%04x:%02x:%02x.%d",
+		 dev->domain, dev->bus, dev->dev, dev->func);
 
 	intel->drmSubFD = drmOpen("i915", busid);
 	if (intel->drmSubFD == -1) {
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 			   "[drm] Failed to open DRM device for %s: %s\n",
 			   busid, strerror(errno));
-		free(busid);
 		return FALSE;
 	}
 
-	free(busid);
-
 	/* Check that what we opened was a master or a master-capable FD,
 	 * by setting the version of the interface we'll use to talk to it.
 	 * (see DRIOpenDRMMaster() in DRI1)


More information about the xorg-commit mailing list