Code quality: Large clean-up of the codebase and especially of the include/ folder

This commit is contained in:
Philippe Tillet
2015-08-06 12:05:12 -07:00
parent df9f6142ef
commit db090d7942
68 changed files with 534 additions and 663 deletions

34
lib/tools/getenv.hpp Normal file
View File

@@ -0,0 +1,34 @@
#ifndef ISAAC_TOOLS_GETENV
#define ISAAC_TOOLS_GETENV
#include <string>
namespace isaac
{
namespace tools
{
inline std::string getenv(const char * name)
{
#ifdef _MSC_VER
char* cache_path = 0;
std::size_t sz = 0;
_dupenv_s(&cache_path, &sz, name);
#else
const char * cache_path = std::getenv(name);
#endif
if(!cache_path)
return "";
std::string result(cache_path);
#ifdef _MSC_VER
free(cache_path);
#endif
return result;
}
}
}
#endif