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
This commit is contained in:
Kyle Evans 2021-08-19 01:17:36 -05:00
parent db7f7446b5
commit dd7c7ff192
2 changed files with 9 additions and 9 deletions

View File

@ -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 */

View File

@ -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);
}
/*