From d8e84ae2eb8c4ff3171e61da9eec6edbb227a066 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 18 Apr 2017 14:16:48 +0000 Subject: [PATCH] Style nits; no binary change. --- usr.bin/file/file.c | 15 ++++++--------- usr.bin/file/magic-load.c | 6 ++---- usr.bin/file/magic-test.c | 4 ++-- usr.bin/file/text.c | 4 ++-- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/usr.bin/file/file.c b/usr.bin/file/file.c index 66709054a92..6304a38c18f 100644 --- a/usr.bin/file/file.c +++ b/usr.bin/file/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.58 2016/05/01 20:34:26 nicm Exp $ */ +/* $OpenBSD: file.c,v 1.59 2017/04/18 14:16:48 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -43,8 +43,7 @@ #include "magic.h" #include "xmalloc.h" -struct input_msg -{ +struct input_msg { int idx; struct stat sb; @@ -55,13 +54,11 @@ struct input_msg int link_target; }; -struct input_ack -{ +struct input_ack { int idx; }; -struct input_file -{ +struct input_file { struct magic *m; struct input_msg *msg; @@ -448,7 +445,7 @@ fill_buffer(int fd, size_t size, size_t *used) if (got == -1) { if (errno == EINTR) continue; - return NULL; + return (NULL); } if (got == 0) break; @@ -456,7 +453,7 @@ fill_buffer(int fd, size_t size, size_t *used) left -= got; } *used = size - left; - return buffer; + return (buffer); } static int diff --git a/usr.bin/file/magic-load.c b/usr.bin/file/magic-load.c index 51f4decde4e..70a3a3fda75 100644 --- a/usr.bin/file/magic-load.c +++ b/usr.bin/file/magic-load.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magic-load.c,v 1.23 2016/05/01 14:57:15 nicm Exp $ */ +/* $OpenBSD: magic-load.c,v 1.24 2017/04/18 14:16:48 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -78,9 +78,7 @@ magic_make_pattern(struct magic_line *ml, const char *name, regex_t *re, static int magic_set_result(struct magic_line *ml, const char *s) { - const char *fmt; - const char *endfmt; - const char *cp; + const char *fmt, *endfmt, *cp; regex_t *re = NULL; regmatch_t pmatch; size_t fmtlen; diff --git a/usr.bin/file/magic-test.c b/usr.bin/file/magic-test.c index 388328787a5..88baab00269 100644 --- a/usr.bin/file/magic-test.c +++ b/usr.bin/file/magic-test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magic-test.c,v 1.24 2016/08/26 08:50:31 guenther Exp $ */ +/* $OpenBSD: magic-test.c,v 1.25 2017/04/18 14:16:48 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -1403,7 +1403,7 @@ magic_test(struct magic *m, const void *base, size_t size, int flags) if (*ms.out != '\0') { if (flags & MAGIC_TEST_MIME) { - if (ms.mimetype) + if (ms.mimetype != NULL) return (xstrdup(ms.mimetype)); return (NULL); } diff --git a/usr.bin/file/text.c b/usr.bin/file/text.c index c027a49c815..f2fb43908f8 100644 --- a/usr.bin/file/text.c +++ b/usr.bin/file/text.c @@ -1,4 +1,4 @@ -/* $OpenBSD: text.c,v 1.2 2015/04/24 16:45:32 nicm Exp $ */ +/* $OpenBSD: text.c,v 1.3 2017/04/18 14:16:48 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -138,7 +138,7 @@ text_try_words(const void *base, size_t size, int flags) size_t wordlen; u_int i; - end = (char *)base + size; + end = (const char *)base + size; for (cp = base; cp != end; /* nothing */) { while (cp != end && isspace((u_char)*cp)) cp++; -- 2.20.1