diff options
author | delphij <delphij@FreeBSD.org> | 2005-01-07 12:06:30 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2005-01-07 12:06:30 +0000 |
commit | 3dde50a830cc94862785e9c183f874936765245f (patch) | |
tree | ac7319c1b07508fa67c430abeaab35de580dc824 /usr.sbin/memcontrol | |
parent | a0afb54e7600be04d8062f67e716d4d348bb3985 (diff) | |
download | FreeBSD-src-3dde50a830cc94862785e9c183f874936765245f.zip FreeBSD-src-3dde50a830cc94862785e9c183f874936765245f.tar.gz |
WARNS=6 cleanup. This includes:
- Apply __unused on unused parameters
- Use const where suitable
- Use PRIu64 instead of the deprecated %q
- Bump WARNS to 6
Diffstat (limited to 'usr.sbin/memcontrol')
-rw-r--r-- | usr.sbin/memcontrol/Makefile | 1 | ||||
-rw-r--r-- | usr.sbin/memcontrol/memcontrol.c | 17 |
2 files changed, 10 insertions, 8 deletions
diff --git a/usr.sbin/memcontrol/Makefile b/usr.sbin/memcontrol/Makefile index d465d53..25009db 100644 --- a/usr.sbin/memcontrol/Makefile +++ b/usr.sbin/memcontrol/Makefile @@ -2,5 +2,6 @@ PROG= memcontrol MAN= memcontrol.8 +WARNS?= 6 .include <bsd.prog.mk> diff --git a/usr.sbin/memcontrol/memcontrol.c b/usr.sbin/memcontrol/memcontrol.c index 9eb8719..4c60fe5 100644 --- a/usr.sbin/memcontrol/memcontrol.c +++ b/usr.sbin/memcontrol/memcontrol.c @@ -32,6 +32,7 @@ #include <err.h> #include <fcntl.h> +#include <inttypes.h> #include <paths.h> #include <stdio.h> #include <stdlib.h> @@ -40,7 +41,7 @@ struct { - char *name; + const char *name; int val; int kind; #define MDF_SETTABLE (1<<0) @@ -64,12 +65,12 @@ static void listfunc(int memfd, int argc, char *argv[]); static void setfunc(int memfd, int argc, char *argv[]); static void clearfunc(int memfd, int argc, char *argv[]); static void helpfunc(int memfd, int argc, char *argv[]); -static void help(char *what); +static void help(const char *what); struct { - char *cmd; - char *desc; + const char *cmd; + const char *desc; void (*func)(int memfd, int argc, char *argv[]); } functions[] = { {"list", @@ -135,7 +136,7 @@ mrgetall(int memfd, int *nmr) *nmr = mro.mo_arg[0]; mrd = malloc(*nmr * sizeof(struct mem_range_desc)); if (mrd == NULL) - errx(1, "can't allocate %d bytes for %d range descriptors", + errx(1, "can't allocate %zd bytes for %d range descriptors", *nmr * sizeof(struct mem_range_desc), *nmr); mro.mo_arg[0] = *nmr; @@ -177,7 +178,7 @@ listfunc(int memfd, int argc, char *argv[]) continue; if (owner && strcmp(mrd[i].mr_owner, owner)) continue; - printf("%qx/%qx %.8s ", mrd[i].mr_base, mrd[i].mr_len, + printf("%" PRIu64 "x/%" PRIu64 "x %.8s ", mrd[i].mr_base, mrd[i].mr_len, mrd[i].mr_owner[0] ? mrd[i].mr_owner : "-"); for (j = 0; attrnames[j].name != NULL; j++) if (mrd[i].mr_flags & attrnames[j].val) @@ -315,13 +316,13 @@ clearfunc(int memfd, int argc, char *argv[]) } static void -helpfunc(int memfd, int argc, char *argv[]) +helpfunc(__unused int memfd, __unused int argc, char *argv[]) { help(argv[1]); } static void -help(char *what) +help(const char *what) { int i; |