svn commit: r365947 - head/sys/kern
Mitchell Horne
mhorne at FreeBSD.org
Mon Sep 21 15:44:24 UTC 2020
Author: mhorne
Date: Mon Sep 21 15:44:23 2020
New Revision: 365947
URL: https://svnweb.freebsd.org/changeset/base/365947
Log:
Use getenv_is_true() in init_static_kenv()
A small example of how these functions can be used to simplify checks of
this nature.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26271
Modified:
head/sys/kern/kern_environment.c
Modified: head/sys/kern/kern_environment.c
==============================================================================
--- head/sys/kern/kern_environment.c Mon Sep 21 15:41:47 2020 (r365946)
+++ head/sys/kern/kern_environment.c Mon Sep 21 15:44:23 2020 (r365947)
@@ -253,7 +253,6 @@ done:
void
init_static_kenv(char *buf, size_t len)
{
- char *eval;
KASSERT(!dynamic_kenv, ("kenv: dynamic_kenv already initialized"));
/*
@@ -301,20 +300,17 @@ init_static_kenv(char *buf, size_t len)
* if the static environment has disabled the loader environment.
*/
kern_envp = static_env;
- eval = kern_getenv("loader_env.disabled");
- if (eval == NULL || strcmp(eval, "1") != 0) {
+ if (!getenv_is_true("loader_env.disabled")) {
md_envp = buf;
md_env_len = len;
md_env_pos = 0;
- eval = kern_getenv("static_env.disabled");
- if (eval != NULL && strcmp(eval, "1") == 0) {
+ if (getenv_is_true("static_env.disabled")) {
kern_envp[0] = '\0';
kern_envp[1] = '\0';
}
}
- eval = kern_getenv("static_hints.disabled");
- if (eval != NULL && strcmp(eval, "1") == 0) {
+ if (getenv_is_true("static_hints.disabled")) {
static_hints[0] = '\0';
static_hints[1] = '\0';
}
More information about the svn-src-head
mailing list