Date: Thu, 19 Aug 2021 17:48:39 GMT From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: dd7c7ff192d0 - main - crunchide: address complaints from WARNS=6 Message-ID: <202108191748.17JHmdai043769@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=dd7c7ff192d07912fb7f5874868649c3aa05944a commit dd7c7ff192d07912fb7f5874868649c3aa05944a Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2021-08-19 06:17:36 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2021-08-19 17:47:18 +0000 crunchide: address complaints from WARNS=6 - One (1) constify - One (1) argument is unused - One (1) local shadows a global - Various globals that should be static Reviewed by: arichardson, imp Differential Revision: https://reviews.freebsd.org/D31608 --- usr.sbin/crunch/crunchide/crunchide.c | 8 ++++---- usr.sbin/crunch/crunchide/exec_elf32.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/usr.sbin/crunch/crunchide/crunchide.c b/usr.sbin/crunch/crunchide/crunchide.c index b7eba3995173..324402501491 100644 --- a/usr.sbin/crunch/crunchide/crunchide.c +++ b/usr.sbin/crunch/crunchide/crunchide.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -char *pname = "crunchide"; +static const char *pname = "crunchide"; void usage(void); @@ -85,7 +85,7 @@ void add_file_to_keep_list(char *filename); int hide_syms(const char *filename); -int verbose; +static int verbose; int main(int, char *[]); @@ -137,7 +137,7 @@ usage(void) /* ---------------------------- */ -struct keep { +static struct keep { struct keep *next; char *sym; } *keep_list; @@ -206,7 +206,7 @@ add_file_to_keep_list(char *filename) /* ---------------------------- */ -struct { +static struct { const char *name; int (*check)(int, const char *); /* 1 if match, zero if not */ int (*hide)(int, const char *); /* non-zero if error */ diff --git a/usr.sbin/crunch/crunchide/exec_elf32.c b/usr.sbin/crunch/crunchide/exec_elf32.c index 28641107cc5c..f7b8601911fe 100644 --- a/usr.sbin/crunch/crunchide/exec_elf32.c +++ b/usr.sbin/crunch/crunchide/exec_elf32.c @@ -155,7 +155,7 @@ xrealloc(void *ptr, size_t size, const char *fn, const char *use) } int -ELFNAMEEND(check)(int fd, const char *fn) +ELFNAMEEND(check)(int fd, const char *fn __unused) { Elf_Ehdr eh; struct stat sb; @@ -435,12 +435,12 @@ ELFNAMEEND(hide)(int fd, const char *fn) * update section header table in ascending order of offset */ for (i = strtabidx + 1; i < shnum; i++) { - Elf_Off off, align; - off = xewtoh(layoutp[i - 1].shdr->sh_offset) + + Elf_Off soff, align; + soff = xewtoh(layoutp[i - 1].shdr->sh_offset) + xewtoh(layoutp[i - 1].shdr->sh_size); align = xewtoh(layoutp[i].shdr->sh_addralign); - off = (off + (align - 1)) & ~(align - 1); - layoutp[i].shdr->sh_offset = htoxew(off); + soff = (soff + (align - 1)) & ~(align - 1); + layoutp[i].shdr->sh_offset = htoxew(soff); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108191748.17JHmdai043769>