From 8909996ec9ff7634473564735ffca0f03043d4dd Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 12 Mar 2014 02:43:44 +0100 Subject: use paths from .h files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/blueshift_drm_c.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/blueshift_drm_c.c b/src/blueshift_drm_c.c index ce37f43..b00660d 100644 --- a/src/blueshift_drm_c.c +++ b/src/blueshift_drm_c.c @@ -33,18 +33,16 @@ * * @return The number of cards present on the system */ -long blueshift_drm_card_count() +int blueshift_drm_card_count() { - long len = strlen("/dev/dri/card"); - char* pathname = alloca((len + 21) * sizeof(char)); - long count = 0; + long maxlen = strlen(DRM_DIR_NAME) + strlen(DRM_DEV_NAME) + 10; + char* pathname = alloca(maxlen * sizeof(char)); + int count = 0; struct stat attr; - memcpy(pathname, "/dev/dri/card", len); - for (;;) { - sprintf(pathname + len, "%li", count); + sprintf(pathname, DRM_DEV_NAME, DRM_DIR_NAME, count); if (stat(pathname, &attr)) break; count++; -- cgit v1.2.3-70-g09d2