summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-12 02:43:44 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-12 02:43:44 +0100
commit8909996ec9ff7634473564735ffca0f03043d4dd (patch)
tree2286ae80ceeae57dda0fd25212d6c8ddf532356e /src
parentdo not use limits.h (diff)
downloadblueshift-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.c12
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++;