diff options
author | ed <ed@FreeBSD.org> | 2010-02-21 13:57:02 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2010-02-21 13:57:02 +0000 |
commit | 1fdea921e1450bf99dc432803cd6c88e08540a21 (patch) | |
tree | fcb4fe1d12f11b6cab916731649d8e0d8c2645b0 /lib/libc/gen/sysctlnametomib.c | |
parent | 24f8e6df2531b9453d13e5fc72bb019b22e630a8 (diff) | |
download | FreeBSD-src-1fdea921e1450bf99dc432803cd6c88e08540a21.zip FreeBSD-src-1fdea921e1450bf99dc432803cd6c88e08540a21.tar.gz |
Add proper const keywords to sysctl(3) parameters.
The `name' and `newp' arguments can be marked const, because the buffers
they refer to are never changed. While there, perform some other
cleanups:
- Remove K&R from sysctl.c.
- Implement sysctlbyname() using sysctlnametomib() to prevent
duplication of an undocumented kernel interface.
- Fix some whitespace nits.
It seems the prototypes are now in sync with NetBSD as well.
Diffstat (limited to 'lib/libc/gen/sysctlnametomib.c')
-rw-r--r-- | lib/libc/gen/sysctlnametomib.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/sysctlnametomib.c b/lib/libc/gen/sysctlnametomib.c index 1515784..afca95d 100644 --- a/lib/libc/gen/sysctlnametomib.c +++ b/lib/libc/gen/sysctlnametomib.c @@ -48,8 +48,8 @@ sysctlnametomib(const char *name, int *mibp, size_t *sizep) oid[0] = 0; oid[1] = 3; - *sizep *= sizeof (int); - error = sysctl(oid, 2, mibp, sizep, (void *)name, strlen(name)); - *sizep /= sizeof (int); + *sizep *= sizeof(int); + error = sysctl(oid, 2, mibp, sizep, name, strlen(name)); + *sizep /= sizeof(int); return (error); } |