loolwsd/LOOLForKit.cpp   |   12 ++++++------
 loolwsd/LOOLKit.cpp      |   13 ++++++-------
 loolwsd/LOOLWSD.cpp      |    4 ++--
 loolwsd/test/helpers.hpp |    3 ++-
 loolwsd/test/test.cpp    |    3 ++-
 5 files changed, 18 insertions(+), 17 deletions(-)

New commits:
commit 9fee650f437c58538d6cf486c4e77b5541cba50c
Author: Tor Lillqvist <t...@collabora.com>
Date:   Wed Oct 12 11:47:26 2016 +0300

    Use std::getenv() consistently

diff --git a/loolwsd/LOOLForKit.cpp b/loolwsd/LOOLForKit.cpp
index 7a38541..735d0d7 100644
--- a/loolwsd/LOOLForKit.cpp
+++ b/loolwsd/LOOLForKit.cpp
@@ -199,10 +199,10 @@ int main(int argc, char** argv)
     }
 
     // Initialization
-    const bool logToFile = getenv("LOOL_LOGFILE");
-    const char* logFilename = getenv("LOOL_LOGFILENAME");
-    const char* logLevel = getenv("LOOL_LOGLEVEL");
-    const char* logColor = getenv("LOOL_LOGCOLOR");
+    const bool logToFile = std::getenv("LOOL_LOGFILE");
+    const char* logFilename = std::getenv("LOOL_LOGFILENAME");
+    const char* logLevel = std::getenv("LOOL_LOGLEVEL");
+    const char* logColor = std::getenv("LOOL_LOGCOLOR");
     std::map<std::string, std::string> logProperties;
     if (logToFile && logFilename)
     {
@@ -220,11 +220,11 @@ int main(int argc, char** argv)
     std::string loTemplate;
 
 #if ENABLE_DEBUG
-    static const char* clientPort = getenv("LOOL_TEST_CLIENT_PORT");
+    static const char* clientPort = std::getenv("LOOL_TEST_CLIENT_PORT");
     if (clientPort)
         ClientPortNumber = std::stoi(clientPort);
 
-    static const char* masterPort = getenv("LOOL_TEST_MASTER_PORT");
+    static const char* masterPort = std::getenv("LOOL_TEST_MASTER_PORT");
     if (masterPort)
         MasterPortNumber = std::stoi(masterPort);
 #endif
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 089b695..d0c5826 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -13,15 +13,14 @@
 
 #include <dlfcn.h>
 #include <ftw.h>
-#include <climits>
 #include <malloc.h>
-#include <cstdlib>
 #include <sys/capability.h>
 #include <unistd.h>
 #include <utime.h>
 
 #include <atomic>
 #include <cassert>
+#include <climits>
 #include <condition_variable>
 #include <cstdlib>
 #include <iostream>
@@ -1304,10 +1303,10 @@ void lokit_main(const std::string& childRoot,
                 bool displayVersion)
 {
     // Reinitialize logging when forked.
-    const bool logToFile = getenv("LOOL_LOGFILE");
-    const char* logFilename = getenv("LOOL_LOGFILENAME");
-    const char* logLevel = getenv("LOOL_LOGLEVEL");
-    const char* logColor = getenv("LOOL_LOGCOLOR");
+    const bool logToFile = std::getenv("LOOL_LOGFILE");
+    const char* logFilename = std::getenv("LOOL_LOGFILENAME");
+    const char* logLevel = std::getenv("LOOL_LOGLEVEL");
+    const char* logColor = std::getenv("LOOL_LOGCOLOR");
     std::map<std::string, std::string> logProperties;
     if (logToFile && logFilename)
     {
@@ -1370,7 +1369,7 @@ void lokit_main(const std::string& childRoot,
 
             // Copy (link) LO installation and other necessary files into it 
from the template.
             bool bLoopMounted = false;
-            if (getenv("LOOL_BIND_MOUNT"))
+            if (std::getenv("LOOL_BIND_MOUNT"))
             {
                 Path usrSrcPath(sysTemplate, "usr");
                 Path usrDestPath(jailPath, "usr");
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 79d1986..ec375ea 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1803,11 +1803,11 @@ void LOOLWSD::handleOption(const std::string& 
optionName,
     else if (optionName == "careerspan")
         careerSpanSeconds = std::stoi(value);
 
-    static const char* clientPort = getenv("LOOL_TEST_CLIENT_PORT");
+    static const char* clientPort = std::getenv("LOOL_TEST_CLIENT_PORT");
     if (clientPort)
         ClientPortNumber = std::stoi(clientPort);
 
-    static const char* masterPort = getenv("LOOL_TEST_MASTER_PORT");
+    static const char* masterPort = std::getenv("LOOL_TEST_MASTER_PORT");
     if (masterPort)
         MasterPortNumber = std::stoi(masterPort);
 #endif
diff --git a/loolwsd/test/helpers.hpp b/loolwsd/test/helpers.hpp
index bed5788..5f5a5c1 100644
--- a/loolwsd/test/helpers.hpp
+++ b/loolwsd/test/helpers.hpp
@@ -10,6 +10,7 @@
 #include "config.h"
 
 #include <algorithm>
+#include <cstdlib>
 #include <condition_variable>
 #include <mutex>
 #include <thread>
@@ -118,7 +119,7 @@ Poco::Net::HTTPClientSession* createSession(const 
Poco::URI& uri)
 inline
 std::string getTestServerURI()
 {
-    static const char* clientPort = getenv("LOOL_TEST_CLIENT_PORT");
+    static const char* clientPort = std::getenv("LOOL_TEST_CLIENT_PORT");
 
     static std::string serverURI(
 #if ENABLE_SSL
diff --git a/loolwsd/test/test.cpp b/loolwsd/test/test.cpp
index d93ccf9..7a081a9 100644
--- a/loolwsd/test/test.cpp
+++ b/loolwsd/test/test.cpp
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <cstdlib>
 #include <iostream>
 
 #include <cppunit/BriefTestProgressListener.h>
@@ -25,7 +26,7 @@ class HTTPGetTest;
 
 bool filterTests(CPPUNIT_NS::TestRunner& runner, CPPUNIT_NS::Test* 
testRegistry)
 {
-    const char* envar = getenv("CPPUNIT_TEST_NAME");
+    const char* envar = std::getenv("CPPUNIT_TEST_NAME");
     if (envar)
     {
         std::string testName(envar);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to