tools/record: narrow the scope of two variables
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 25 Jan 2021 06:30:22 +0000 (16:30 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 28 Jan 2021 21:31:46 +0000 (07:31 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tools/libinput-record.c

index b9f8f13a27b50db481745ae117d1395cf2e84b97..735675084f9801753007aa3b3f4d53c7ddb9cd50 100644 (file)
@@ -2117,8 +2117,6 @@ mainloop(struct record_context *ctx)
        struct pollfd fds[ctx->ndevices + 2];
        unsigned int nfds = 0;
        struct record_device *d = NULL;
-       struct record_device *first_device = NULL;
-       struct timespec ts;
        sigset_t mask;
 
        assert(ctx->timeout != 0);
@@ -2157,6 +2155,8 @@ mainloop(struct record_context *ctx)
         * start time. Otherwise, the first event starts the recording time.
         */
        if (ctx->ndevices > 1) {
+               struct timespec ts;
+
                clock_gettime(CLOCK_MONOTONIC, &ts);
                ctx->offset = s2us(ts.tv_sec) + ns2us(ts.tv_nsec);
        }
@@ -2164,6 +2164,7 @@ mainloop(struct record_context *ctx)
        do {
                int rc;
                bool had_events = false; /* we delete files without events */
+               struct record_device *first_device = NULL;
 
                if (!open_output_file(ctx, autorestart)) {
                        fprintf(stderr,