[arrayfire] 127/284: Cleanup util.cpp

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:26 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.

commit 1dd21957148047897d387cb154c3856ad90a8d32
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Thu Dec 31 10:25:26 2015 -0500

    Cleanup util.cpp
---
 CMakeLists.txt                    |  1 -
 src/api/unified/CMakeLists.txt    |  2 +-
 src/backend/cpu/CMakeLists.txt    |  1 -
 src/backend/cuda/CMakeLists.txt   |  1 -
 src/backend/opencl/CMakeLists.txt |  1 -
 src/{ => backend}/util.cpp        | 25 +++++++++++--------------
 src/{ => backend}/util.hpp        |  0
 7 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bc00e15..c79fbca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,7 +113,6 @@ IF(BUILD_SIFT)
 ENDIF(BUILD_SIFT)
 
 INCLUDE_DIRECTORIES(
-    "${CMAKE_CURRENT_SOURCE_DIR}/src"
     "${CMAKE_CURRENT_SOURCE_DIR}/include"
     "${CMAKE_CURRENT_SOURCE_DIR}/src/backend"
     "${CMAKE_CURRENT_SOURCE_DIR}/src/api/c"
diff --git a/src/api/unified/CMakeLists.txt b/src/api/unified/CMakeLists.txt
index b6980d6..21c9aeb 100644
--- a/src/api/unified/CMakeLists.txt
+++ b/src/api/unified/CMakeLists.txt
@@ -15,12 +15,12 @@ FILE(GLOB cpp_sources
 SOURCE_GROUP(api\\cpp\\Sources FILES ${cpp_sources})
 
 FILE(GLOB common_sources
-    "../../util.cpp"
     "../c/util.cpp"
     "../c/err_common.cpp"
     "../c/type_util.cpp"
     "../c/version.cpp"
     "../../backend/dim4.cpp"
+    "../../backend/util.cpp"
     )
 
 SOURCE_GROUP(common FILES ${common_sources})
diff --git a/src/backend/cpu/CMakeLists.txt b/src/backend/cpu/CMakeLists.txt
index bf72a8a..b0ab17a 100644
--- a/src/backend/cpu/CMakeLists.txt
+++ b/src/backend/cpu/CMakeLists.txt
@@ -107,7 +107,6 @@ source_group(api\\c\\Headers FILES ${c_headers})
 source_group(api\\c\\Sources FILES ${c_sources})
 
 FILE(GLOB cpp_sources
-    "../../util.cpp"
     "../../api/cpp/*.cpp"
     )
 
diff --git a/src/backend/cuda/CMakeLists.txt b/src/backend/cuda/CMakeLists.txt
index ee7b86f..bb8fca0 100644
--- a/src/backend/cuda/CMakeLists.txt
+++ b/src/backend/cuda/CMakeLists.txt
@@ -178,7 +178,6 @@ FILE(GLOB c_headers
     )
 
 FILE(GLOB c_sources
-    "../../util.cpp"
     "../../api/c/*.cpp"
     )
 
diff --git a/src/backend/opencl/CMakeLists.txt b/src/backend/opencl/CMakeLists.txt
index 223752c..86ba1b2 100644
--- a/src/backend/opencl/CMakeLists.txt
+++ b/src/backend/opencl/CMakeLists.txt
@@ -152,7 +152,6 @@ FILE(GLOB backend_headers
     )
 
 FILE(GLOB backend_sources
-    "../../util.cpp"
     "../*.cpp"
     )
 source_group(backend\\Headers FILES ${backend_headers})
diff --git a/src/util.cpp b/src/backend/util.cpp
similarity index 59%
rename from src/util.cpp
rename to src/backend/util.cpp
index 5607292..7c4cd2e 100644
--- a/src/util.cpp
+++ b/src/backend/util.cpp
@@ -13,9 +13,6 @@
 
 #if defined(OS_WIN)
 #include <Windows.h>
-typedef HMODULE LibHandle;
-#else
-#include <dlfcn.h>
 #endif
 
 using std::string;
@@ -23,18 +20,18 @@ using std::string;
 string getEnvVar(const std::string &key)
 {
 #if defined(OS_WIN)
-  DWORD bufSize = 32767; // limit according to GetEnvironment Variable documentation
-  string retVal;
-  retVal.resize(bufSize);
-  bufSize = GetEnvironmentVariable(key.c_str(), &retVal[0], bufSize);
-  if (!bufSize) {
-    return string("");
-  } else {
+    DWORD bufSize = 32767; // limit according to GetEnvironment Variable documentation
+    string retVal;
     retVal.resize(bufSize);
-    return retVal;
-  }
+    bufSize = GetEnvironmentVariable(key.c_str(), &retVal[0], bufSize);
+    if (!bufSize) {
+        return string("");
+    } else {
+        retVal.resize(bufSize);
+        return retVal;
+    }
 #else
-  char * str = getenv(key.c_str());
-  return str==NULL ? string("") : string(str);
+    char * str = getenv(key.c_str());
+    return str==NULL ? string("") : string(str);
 #endif
 }
diff --git a/src/util.hpp b/src/backend/util.hpp
similarity index 100%
rename from src/util.hpp
rename to src/backend/util.hpp

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list