xiaoxiang781216 commented on code in PR #21217:
URL: https://github.com/apache/nuttx/pull/21217#discussion_r4431351816


##########
libs/libc/environ/env_setenv.c:
##########
@@ -82,18 +130,11 @@ int env_setvar(FAR const char *name, size_t namelen,
       env_removevar(info, idx);
     }
 
-  /* An empty value removes the variable */
-
-  if (*value == '\0')
-    {
-      goto out;
-    }
-
   /* Get the size of the new name=value string.
    * The +2 is for the '=' and for null terminator
    */
 
-  varlen = namelen + strlen(value) + 2;
+  varlen = strlen(name) + strlen(value) + 2;

Review Comment:
   save name length to avoid strlen twice



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to