diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-03-12 02:43:44 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-03-12 02:43:44 +0100 |
commit | 8909996ec9ff7634473564735ffca0f03043d4dd (patch) | |
tree | 2286ae80ceeae57dda0fd25212d6c8ddf532356e /src | |
parent | do not use limits.h (diff) | |
download | blueshift-8909996ec9ff7634473564735ffca0f03043d4dd.tar.gz blueshift-8909996ec9ff7634473564735ffca0f03043d4dd.tar.bz2 blueshift-8909996ec9ff7634473564735ffca0f03043d4dd.tar.xz |
use paths from .h files
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/blueshift_drm_c.c | 12 |
1 files changed, 5 insertions, 7 deletions
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++; |