commit 1921219eb7606c0be7ad940380514555a933bde6
Author:     Mattias Andrée <[email protected]>
AuthorDate: Wed May 3 21:53:25 2017 +0200
Commit:     Mattias Andrée <[email protected]>
CommitDate: Wed May 3 21:53:25 2017 +0200

    Minor rewrite of blind-single-colour.c
    
    Signed-off-by: Mattias Andrée <[email protected]>

diff --git a/src/blind-single-colour.c b/src/blind-single-colour.c
index 2a6511d..8eb25b9 100644
--- a/src/blind-single-colour.c
+++ b/src/blind-single-colour.c
@@ -13,7 +13,7 @@ typedef double pixel_t[4];
 int
 main(int argc, char *argv[])
 {
-       struct stream stream;
+       struct stream stream = { .width = 0, .height = 0, .frames = 1 };
        double X, Y, Z, alpha = 1;
        size_t x, y, n;
        pixel_t buf[BUFSIZ / 4];
@@ -21,10 +21,6 @@ main(int argc, char *argv[])
        int inf = 0;
        char *arg;
 
-       stream.width = 0;
-       stream.height = 0;
-       stream.frames = 1;
-
        ARGBEGIN {
        case 'f':
                arg = UARGF();
@@ -71,18 +67,12 @@ main(int argc, char *argv[])
                buf[x][2] = Z;
                buf[x][3] = alpha;
        }
-       while (inf || stream.frames--) {
-               for (y = stream.height; y--;) {
-                       for (x = stream.width; x;) {
-                               x -= n = MIN(ELEMENTSOF(buf), x);
-                               for (n *= sizeof(*buf); n; n -= (size_t)r) {
-                                       r = write(STDOUT_FILENO, buf, n);
-                                       if (r < 0)
+       while (inf || stream.frames--)
+               for (y = stream.height; y--;)
+                       for (x = stream.width * sizeof(*buf); x;)
+                               for (x -= n = MIN(sizeof(buf), x); n; n -= 
(size_t)r)
+                                       if ((r = write(STDOUT_FILENO, buf, n)) 
< 0)
                                                eprintf("write <stdout>:");
-                               }
-                       }
-               }
-       }
 
        return 0;
 }

Reply via email to