From d742f6acbb0107196480e43a0e26231c56479dcd Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Fri, 26 Aug 2022 17:08:44 +0200 Subject: [PATCH] Process: Avoid calling `strlen()` repeatedly & remove some dead code --- lib/base/process.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/base/process.cpp b/lib/base/process.cpp index 7aa7972cb..90dcce59b 100644 --- a/lib/base/process.cpp +++ b/lib/base/process.cpp @@ -109,11 +109,11 @@ static Value ProcessSpawnImpl(struct msghdr *msgh, const Dictionary::Ptr& reques int j = 0; for (int i = 0; i < envc; i++) { - if (strncmp(environ[i], lcnumeric, strlen(lcnumeric)) == 0) { + if (strcmp(environ[i], lcnumeric) == 0) { continue; } - if (strncmp(environ[i], notifySocket, strlen(notifySocket)) == 0) { + if (strcmp(environ[i], notifySocket) == 0) { continue; } @@ -292,9 +292,6 @@ static void ProcessHandler() } count += rc; - - if (rc == 0) - break; } String jrequest = String(mbuf, mbuf + count);