about summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/setenv.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/stdlib/setenv.c b/stdlib/setenv.c
index 05342367b1..b60c4f0151 100644
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -114,16 +114,8 @@ __add_to_environ (name, value, combined, replace)
 {
   char **ep;
   size_t size;
-
-  /* Compute lengths before locking, so that the critical section is
-     less of a performance bottleneck.  VALLEN is needed only if
-     COMBINED is non-null.  Also, testing COMBINED instead of VALUE
-     causes setenv (..., NULL, ...) to dump core now instead of
-     corrupting memory later.  */
   const size_t namelen = strlen (name);
-  size_t vallen;
-  if (combined != NULL)
-    vallen = strlen (value) + 1;
+  const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
 
   LOCK;