Add optimization TODO
[khatus.git] / x5 / khatus.c
index 4acb956..293b346 100644 (file)
@@ -255,6 +255,7 @@ read_one(Fifo *f, char *buf)
        total = 0;
        c = '\0';
        b = buf + f->pos;
+       /* TODO: Could optimize here and only blank-out the remaining slots. */
        memset(b, ' ', f->width);
        while ((current = read(f->fd, &c, 1)) && c != '\n' && c != '\0' && total++ < f->width)
                *b++ = c;
@@ -308,12 +309,13 @@ read_all(Config *cfg, char *buf)
 int
 main(int argc, char *argv[])
 {
-       int width;
+       int width  = 0;
        int nfifos = 0;
-       int seplen;
+       int seplen = 0;
        int prefix = 0;
        char *buf;
-       Config *cfg = &defaults;
+       Config cfg0 = defaults;
+       Config *cfg = &cfg0;
        Display *display = NULL;
 
        argv0 = argv[0];
@@ -350,6 +352,7 @@ main(int argc, char *argv[])
        if (cfg->output_to_x_root_window && !(display = XOpenDisplay(NULL)))
                fatal("XOpenDisplay failed with: %p\n", display);
        /* TODO: nanosleep and nano time diff */
+       /* TODO: Handle signals */
        for (;;) {
                /* TODO: Check TTL and maybe blank-out */
                /* TODO: How to trigger TTL check? On select? Alarm signal? */
@@ -366,4 +369,6 @@ main(int argc, char *argv[])
                        fflush(stdout);
                }
        }
+
+       return EXIT_SUCCESS;
 }
This page took 0.021979 seconds and 4 git commands to generate.