提交 7fe51ea8 编写于 作者: F Frediano Ziglio 提交者: Rich Felker

use __strchrnul instead of strchr and strlen in execvpe

The result is the same but takes less code.
Note that __execvpe calls getenv which calls __strchrnul so even
using static output the size of the executable won't grow.
上级 086a12b9
......@@ -28,8 +28,7 @@ int __execvpe(const char *file, char *const argv[], char *const envp[])
for(p=path; ; p=z) {
char b[l+k+1];
z = strchr(p, ':');
if (!z) z = p+strlen(p);
z = __strchrnul(p, ':');
if (z-p >= l) {
if (!*z++) break;
continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册