DragonFly submit List (threaded) for 2005-01
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: sysctl warns6 cleanup
On Sat, Jan 08, 2005 at 12:14:40PM -0800, Chris Pressey wrote:
> @@ -355,7 +353,7 @@
> * may seem, there are various conflicting requirements.
> */
>
> -static int
> +static size_t
> name2oid(char *name, int *oidp)
> {
> int oid[2];
> @@ -367,14 +365,14 @@
>
> j = CTL_MAXNAME * sizeof(int);
> i = sysctl(oid, 2, oidp, &j, name, strlen(name));
> - if (i < 0)
> - return i;
> + if (i < 0)
> + errx(1, "unknown oid '%s'", name);
> j /= sizeof(int);
> return (j);
> }
Eliminate this helper function and use sysctlnametomib from libc.
> @@ -616,10 +615,11 @@
> }
>
> static int
> -sysctl_all (int *oid, int len)
> +sysctl_all(int *oid, size_t len)
> {
> int name1[22], name2[22];
> int i, j;
> + unsigned int k;
size_t k ? It seems you can merge i and j, name it retval or so :)
Rest is fine.
Joerg
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]