From e21ed5d2c5b7ac0759c7a52e81c0fd941e3bf3dd Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Tue, 5 Sep 2023 23:36:22 +0100 Subject: [PATCH] Reformatted with indent. --- src/pv/cursor.c | 23 ++++++++++++----------- src/pv/elapsedtime.c | 20 ++++++++++---------- src/pv/string.c | 6 +++--- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/pv/cursor.c b/src/pv/cursor.c index 07e8896..ec986cf 100644 --- a/src/pv/cursor.c +++ b/src/pv/cursor.c @@ -117,7 +117,7 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd) openflags = O_RDWR | O_CREAT; #endif - state->crs_lock_fd = open(state->crs_lock_file, openflags, 0600); /* flawfinder: ignore */ + state->crs_lock_fd = open(state->crs_lock_file, openflags, 0600); /* flawfinder: ignore */ /* * flawfinder rationale: we aren't truncating the lock file, we @@ -240,7 +240,7 @@ static int pv_crs_get_ypos(int terminalfd) { struct termios tty; struct termios old_tty; - char cpr[32]; /* flawfinder: ignore - bounded, zeroed */ + char cpr[32]; /* flawfinder: ignore - bounded, zeroed */ int ypos; ssize_t r; #ifdef CURSOR_ANSWERBACK_BYTE_BY_BYTE @@ -346,9 +346,10 @@ static int pv_crs_ipcinit(pvstate_t state, char *ttyfile, int terminalfd) return 1; } - /*@-nullpass@*//* splint doesn't know shmaddr can be NULL */ + /*@-nullpass@ */ + /* splint doesn't know shmaddr can be NULL */ state->crs_shared = shmat(state->crs_shmid, NULL, 0); - /*@+nullpass@*/ + /*@+nullpass@ */ pv_crs_ipccount(state); @@ -410,7 +411,7 @@ void pv_crs_init(pvstate_t state) return; } - terminalfd = open(ttyfile, O_RDWR); /* flawfinder: ignore */ + terminalfd = open(ttyfile, O_RDWR); /* flawfinder: ignore */ /* * flawfinder rationale: the file we open won't be truncated but @@ -523,7 +524,7 @@ static void pv_crs_reinit(pvstate_t state) */ void pv_crs_update(pvstate_t state, const char *output_line) { - char cup_cmd[32]; /* flawfinder: ignore */ + char cup_cmd[32]; /* flawfinder: ignore */ size_t cup_cmd_length, output_line_length; int y; @@ -534,8 +535,8 @@ void pv_crs_update(pvstate_t state, const char *output_line) * string it writes. The write() call is also bounded. */ - output_line_length = strlen(output_line); /* flawfinder: ignore */ - /* flawfinder - output_line is explictly expected to be \0-terminated. */ + output_line_length = strlen(output_line); /* flawfinder: ignore */ + /* flawfinder - output_line is explictly expected to be \0-terminated. */ #ifdef HAVE_IPC if (!state->crs_noipc) { @@ -610,7 +611,7 @@ void pv_crs_update(pvstate_t state, const char *output_line) memset(cup_cmd, 0, sizeof(cup_cmd)); (void) pv_snprintf(cup_cmd, sizeof(cup_cmd), "\033[%d;1H", y); - cup_cmd_length = strlen(cup_cmd); /* flawfinder: ignore */ + cup_cmd_length = strlen(cup_cmd); /* flawfinder: ignore */ /* * flawfinder rationale: "cup_cmd" is only written to by @@ -633,7 +634,7 @@ void pv_crs_update(pvstate_t state, const char *output_line) */ void pv_crs_fini(pvstate_t state) { - char cup_cmd[32]; /* flawfinder: ignore */ + char cup_cmd[32]; /* flawfinder: ignore */ unsigned int y; struct shmid_ds shm_buf; @@ -664,7 +665,7 @@ void pv_crs_fini(pvstate_t state) pv_crs_lock(state, STDERR_FILENO); - pv_write_retry(STDERR_FILENO, cup_cmd, strlen(cup_cmd)); /* flawfinder: ignore */ + pv_write_retry(STDERR_FILENO, cup_cmd, strlen(cup_cmd)); /* flawfinder: ignore */ /* flawfinder - pv_snprintf() always \0-terminates (see above). */ /* diff --git a/src/pv/elapsedtime.c b/src/pv/elapsedtime.c index 6fa16a5..ba427a1 100644 --- a/src/pv/elapsedtime.c +++ b/src/pv/elapsedtime.c @@ -25,14 +25,14 @@ */ void pv_elapsedtime_read(struct timespec *return_time) { - /*@-unrecog@*/ /* splint doesn't know clock_gettime */ + /*@-unrecog@ *//* splint doesn't know clock_gettime */ if (0 != clock_gettime(CLOCK_MONOTONIC, return_time)) { fprintf(stderr, "%s: %s: %s\n", PACKAGE_NAME, "clock_gettime", strerror(errno)); - /*@-exitarg@*/ /* we explicitly want a special exit status */ + /*@-exitarg@ *//* we explicitly want a special exit status */ exit(16); - /*@+exitarg@*/ + /*@+exitarg@ */ } - /*@+unrecog@*/ + /*@+unrecog@ */ } @@ -126,10 +126,10 @@ void pv_elapsedtime_add(struct timespec *return_time, const struct timespec *fir seconds += nanoseconds / 1000000000; nanoseconds = nanoseconds % 1000000000; - /*@-type@*/ + /*@-type@ */ return_time->tv_sec = seconds; return_time->tv_nsec = nanoseconds; - /*@+type@*/ + /*@+type@ */ /* * splint rationale: we know the types are different but should be @@ -159,10 +159,10 @@ void pv_elapsedtime_add_nsec(struct timespec *return_time, long long add_nanosec seconds += nanoseconds / 1000000000; nanoseconds = nanoseconds % 1000000000; - /*@-type@*/ /* see above */ + /*@-type@ *//* see above */ return_time->tv_sec = seconds; return_time->tv_nsec = nanoseconds; - /*@+type@*/ + /*@+type@ */ } @@ -198,10 +198,10 @@ void pv_elapsedtime_subtract(struct timespec *return_time, const struct timespec nanoseconds = 1000000000 + nanoseconds; } - /*@-type@*/ /* see above */ + /*@-type@ *//* see above */ return_time->tv_sec = seconds; return_time->tv_nsec = nanoseconds; - /*@+type@*/ + /*@+type@ */ } diff --git a/src/pv/string.c b/src/pv/string.c index d0979a6..ecaa0bc 100644 --- a/src/pv/string.c +++ b/src/pv/string.c @@ -42,7 +42,7 @@ int pv_snprintf(char *str, size_t size, const char *format, ...) #ifdef HAVE_VSNPRINTF ret = vsnprintf(str, size, format, ap); /* flawfinder: ignore */ #else /* ! HAVE_VSNPRINTF */ - ret = vsprintf(str, format, ap); /* flawfinder: ignore */ + ret = vsprintf(str, format, ap); /* flawfinder: ignore */ #endif /* HAVE_VSNPRINTF */ va_end(ap); @@ -96,8 +96,8 @@ size_t pv_strlcat(char *dst, const char *src, size_t dstsize) return 0; dst[dstsize - 1] = '\0'; - dstlen = strlen(dst); /* flawfinder: ignore */ - srclen = strlen(src); /* flawfinder: ignore */ + dstlen = strlen(dst); /* flawfinder: ignore */ + srclen = strlen(src); /* flawfinder: ignore */ /* * flawfinder rationale: src must explicitly be \0 terminated, so