diff options
author | jhb <jhb@FreeBSD.org> | 2001-01-30 20:13:02 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-01-30 20:13:02 +0000 |
commit | 30e6f820c3fa4a3eec53071d1fa337a6103f45c5 (patch) | |
tree | e26a0199fd7ff56871da142cad6c0f34bf6a0c7a | |
parent | 1a8382d6ee1da9ec7ac39eca344cae3440f250e5 (diff) | |
download | FreeBSD-src-30e6f820c3fa4a3eec53071d1fa337a6103f45c5.zip FreeBSD-src-30e6f820c3fa4a3eec53071d1fa337a6103f45c5.tar.gz |
- Fix TUNABLE_STR_FETCH() to actually be a code fragment rather than
declaring a static function.
- Modify TUNABLE_*_DECL() to use TUNABLE_*_FETCH() to avoid code
duplication.
Reviewed by: peter
-rw-r--r-- | sys/sys/kernel.h | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index 47feb9d..0ae9738 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -257,8 +257,7 @@ void sysinit_add __P((struct sysinit **set)); #define TUNABLE_INT_DECL(path, defval, var) \ static void __Tunable_ ## var (void *ignored) \ { \ - if (!getenv_int((path), &(var))) \ - (var) = (defval); \ + TUNABLE_INT_FETCH((path), (defval), (var)) \ } \ SYSINIT(__Tunable_init_ ## var, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, __Tunable_ ## var , NULL); @@ -269,18 +268,11 @@ SYSINIT(__Tunable_init_ ## var, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, __Tunable_ ## #define TUNABLE_STR_DECL(path, defval, var, size) \ static void __Tunable_ ## var (void *ignored) \ { \ - char *tmp; \ - tmp = getenv((path)); \ - if (tmp == NULL) \ - tmp = (defval); \ - strncpy((var), tmp, (size)); \ - (var)[(size) - 1] = 0; \ + TUNABLE_STR_FETCH((path), (defval), (var), (size)) \ } \ SYSINIT(__Tunable_init_ ## var, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, __Tunable_ ## var , NULL); #define TUNABLE_STR_FETCH(path, defval, var, size) \ -static void __Tunable_ ## var (void *ignored) \ -{ \ char *tmp; \ tmp = getenv((path)); \ if (tmp == NULL) \ |