[Spice-commits] vdservice/vdservice.cpp

Frediano Ziglio fziglio at kemper.freedesktop.org
Fri Jul 21 14:00:43 UTC 2017


 vdservice/vdservice.cpp |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit cf7a92965525dd98b2d7cdf0ffd7d46414c04fa0
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Jul 20 13:48:10 2017 +0100

    Use single variable for path computations
    
    This saves some stack memory not reducing any readability.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
index 7f3a5a3..329f9c2 100644
--- a/vdservice/vdservice.cpp
+++ b/vdservice/vdservice.cpp
@@ -306,19 +306,18 @@ VOID WINAPI VDService::main(DWORD argc, TCHAR* argv[])
 {
     VDService* s = new VDService;
     SERVICE_STATUS* status;
-    TCHAR full_path[MAX_PATH];
-    TCHAR temp_path[MAX_PATH];
+    TCHAR path[MAX_PATH];
     TCHAR* slash;
 
     ASSERT(s);
-    if (GetTempPath(MAX_PATH, temp_path)) {
+    if (GetTempPath(MAX_PATH, path)) {
         TCHAR log_path[MAX_PATH];
-        swprintf_s(log_path, MAX_PATH, VD_SERVICE_LOG_PATH, temp_path);
+        swprintf_s(log_path, MAX_PATH, VD_SERVICE_LOG_PATH, path);
         s->_log = VDLog::get(log_path);
     }
-    if (GetModuleFileName(NULL, full_path, MAX_PATH) && (slash = wcsrchr(full_path, TCHAR('\\')))) {
+    if (GetModuleFileName(NULL, path, MAX_PATH) && (slash = wcsrchr(path, TCHAR('\\')))) {
         *slash = TCHAR('\0');
-        swprintf_s(s->_agent_path, MAX_PATH, VD_AGENT_PATH, full_path);
+        swprintf_s(s->_agent_path, MAX_PATH, VD_AGENT_PATH, path);
     }
     vd_printf("***Service started***");
     log_version();


More information about the Spice-commits mailing list