You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2021/01/06 10:40:35 UTC

[commons-daemon] branch master updated: Fix DAEMON-428 remove unnecessary code

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git


The following commit(s) were added to refs/heads/master by this push:
     new 9fd004f  Fix DAEMON-428 remove unnecessary code
9fd004f is described below

commit 9fd004f79277620c4e5023319673e05c028ce6f6
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jan 6 10:39:57 2021 +0000

    Fix DAEMON-428 remove unnecessary code
    
    https://issues.apache.org/jira/browse/DAEMON-428
---
 src/changes/changes.xml        |  3 +++
 src/native/windows/src/utils.c | 10 ++--------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6a4709d..ca702fa 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -52,6 +52,9 @@
         Fall back to using argv[0] rather than /proc/self/exe to determine the
         path for the current binary.
       </action>
+      <action issue="DAEMON-428" type="fix" dev="markt">
+        Procrun. Remove some unnecessary code.
+      </action>
     </release>
     <release version="1.2.3" date="2020-09-01" description="Bug fix release">
       <action issue="DAEMON-411" type="fix" dev="markt">
diff --git a/src/native/windows/src/utils.c b/src/native/windows/src/utils.c
index 21a26f1..f7695f8 100644
--- a/src/native/windows/src/utils.c
+++ b/src/native/windows/src/utils.c
@@ -242,10 +242,7 @@ apxSetEnvironmentVariable(APXHANDLE hPool, LPCTSTR szName, LPCTSTR szValue,
         DWORD l = GetEnvironmentVariable(szName, NULL, 0);
         if (l > 0) {
             BOOL rv;
-            if (IS_INVALID_HANDLE(hPool))
-                szNew = apxAlloc(l + lstrlen(szValue) + 3);
-            else
-                szNew = apxPoolAlloc(hPool, l + lstrlen(szValue) + 3);
+            szNew = apxPoolAlloc(hPool, l + lstrlen(szValue) + 3);
             GetEnvironmentVariable(szName, szNew, l + 1);
             lstrcat(szNew, TEXT(";"));
             lstrcat(szNew, szValue);
@@ -271,10 +268,7 @@ apxMultiSzToArrayW(APXHANDLE hPool, LPCWSTR lpString, LPWSTR **lppArray)
     l = __apxGetMultiSzLengthW(lpString, &n);
     if (!n || !l)
         return 0;
-    if (IS_INVALID_HANDLE(hPool))
-        buff = apxPoolAlloc(hPool, (n + 2) * sizeof(LPWSTR) + (l + 1) * sizeof(WCHAR));
-    else
-        buff = apxAlloc((n + 2) * sizeof(LPWSTR) + (l + 1) * sizeof(WCHAR));
+    buff = apxPoolAlloc(hPool, (n + 2) * sizeof(LPWSTR) + (l + 1) * sizeof(WCHAR));
 
     *lppArray = (LPWSTR *)buff;
     p = (LPWSTR)(buff + (n + 2) * sizeof(LPWSTR));