From owner-svn-src-all@freebsd.org Sun Nov 18 12:03:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53FAD11379E4; Sun, 18 Nov 2018 12:03:13 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EBE8F79E6E; Sun, 18 Nov 2018 12:03:12 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC4311319C; Sun, 18 Nov 2018 12:03:12 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wAIC3CFx048012; Sun, 18 Nov 2018 12:03:12 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wAIC3Cre048011; Sun, 18 Nov 2018 12:03:12 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201811181203.wAIC3Cre048011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Nov 2018 12:03:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340567 - head/usr.bin/brandelf X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/usr.bin/brandelf X-SVN-Commit-Revision: 340567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EBE8F79E6E X-Spamd-Result: default: False [0.04 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_SHORT(0.04)[0.039,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Nov 2018 12:03:13 -0000 Author: oshogbo Date: Sun Nov 18 12:03:12 2018 New Revision: 340567 URL: https://svnweb.freebsd.org/changeset/base/340567 Log: brandelf: fix style nits No functional change intended. Reviewed by: emaste, markj Differential Revision: https://reviews.freebsd.org/D17966 Modified: head/usr.bin/brandelf/brandelf.c Modified: head/usr.bin/brandelf/brandelf.c ============================================================================== --- head/usr.bin/brandelf/brandelf.c Sun Nov 18 11:55:58 2018 (r340566) +++ head/usr.bin/brandelf/brandelf.c Sun Nov 18 12:03:12 2018 (r340567) @@ -32,11 +32,13 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include + #include #include +#include #include #include #include @@ -64,16 +66,21 @@ main(int argc, char **argv) { const char *strtype = "FreeBSD"; - int type = ELFOSABI_FREEBSD; - int retval = 0; - int ch, change = 0, force = 0, listed = 0; + int ch, retval, type; + bool change, force, listed; + type = ELFOSABI_FREEBSD; + retval = 0; + change = false; + force = false; + listed = false; + while ((ch = getopt(argc, argv, "f:lt:v")) != -1) switch (ch) { case 'f': if (change) errx(1, "f option incompatible with t option"); - force = 1; + force = true; type = atoi(optarg); if (errno == ERANGE || type < 0 || type > 255) { warnx("invalid argument to option f: %s", @@ -83,7 +90,7 @@ main(int argc, char **argv) break; case 'l': printelftypes(); - listed = 1; + listed = true; break; case 'v': /* does nothing */ @@ -91,7 +98,7 @@ main(int argc, char **argv) case 't': if (force) errx(1, "t option incompatible with f option"); - change = 1; + change = true; strtype = optarg; break; default: @@ -99,7 +106,7 @@ main(int argc, char **argv) } argc -= optind; argv += optind; - if (!argc) { + if (argc == 0) { if (listed) exit(0); else { @@ -114,7 +121,7 @@ main(int argc, char **argv) usage(); } - while (argc) { + while (argc != 0) { int fd; char buffer[EI_NIDENT]; @@ -160,7 +167,7 @@ fail: argv++; } - return retval; + return (retval); } static void @@ -176,12 +183,10 @@ iselftype(int etype) { size_t elfwalk; - for (elfwalk = 0; - elfwalk < sizeof(elftypes)/sizeof(elftypes[0]); - elfwalk++) + for (elfwalk = 0; elfwalk < nitems(elftypes); elfwalk++) if (etype == elftypes[elfwalk].value) - return elftypes[elfwalk].str; - return 0; + return (elftypes[elfwalk].str); + return (0); } static int @@ -189,12 +194,10 @@ elftype(const char *elfstrtype) { size_t elfwalk; - for (elfwalk = 0; - elfwalk < sizeof(elftypes)/sizeof(elftypes[0]); - elfwalk++) + for (elfwalk = 0; elfwalk < nitems(elftypes); elfwalk++) if (strcasecmp(elfstrtype, elftypes[elfwalk].str) == 0) - return elftypes[elfwalk].value; - return -1; + return (elftypes[elfwalk].value); + return (-1); } static void @@ -203,10 +206,8 @@ printelftypes(void) size_t elfwalk; fprintf(stderr, "known ELF types are: "); - for (elfwalk = 0; - elfwalk < sizeof(elftypes)/sizeof(elftypes[0]); - elfwalk++) - fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str, - elftypes[elfwalk].value); + for (elfwalk = 0; elfwalk < nitems(elftypes); elfwalk++) + fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str, + elftypes[elfwalk].value); fprintf(stderr, "\n"); }