fdev: Improve readability
authorJosé Bollo <jose.bollo@iot.bzh>
Fri, 16 Mar 2018 10:37:01 +0000 (11:37 +0100)
committerJosé Bollo <jose.bollo@iot.bzh>
Fri, 16 Mar 2018 15:27:01 +0000 (16:27 +0100)
Change-Id: If81cdf43703b6ff3128ea79940ce240f56918b9d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/fdev.c

index 5c31d31..8ad79b5 100644 (file)
@@ -45,7 +45,7 @@ struct fdev *fdev_create(int fd)
        else {
                fdev->fd = fd;
                fdev->refcount = 3; /* set autoclose by default */
-               fdev->repeat = -1;
+               fdev->repeat = -1; /* always repeat by default */
        }
        return fdev;
 }
@@ -151,8 +151,8 @@ void fdev_set_repeat(struct fdev *fdev, int count)
 void fdev_set_autoclose(struct fdev *fdev, int autoclose)
 {
        if (autoclose)
-               fdev->refcount |= 1;
+               fdev->refcount |= (unsigned)1;
        else
-               fdev->refcount &= -2;
+               fdev->refcount &= ~(unsigned)1;
 }