Skip to content

Commit

Permalink
use rcpputils::get_env_var, remove obsolete function and added namespace
Browse files Browse the repository at this point in the history
Signed-off-by: Dirk Thomas <[email protected]>
  • Loading branch information
dirk-thomas committed Jan 15, 2020
1 parent 9752a8f commit c4ccfbf
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions rmw_implementation/src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,37 +35,12 @@
#define STRINGIFY_(s) #s
#define STRINGIFY(s) STRINGIFY_(s)

namespace
{

// TODO(eric.cousineau): Use rcutils_get_env pending debugging usage on
// Windows.
std::string get_env_var(const char * env_var)
{
char * value = nullptr;
#ifndef _WIN32
value = getenv(env_var);
#else
size_t value_size;
_dupenv_s(&value, &value_size, env_var);
#endif
std::string value_str = "";
if (value) {
value_str = value;
#ifdef _WIN32
free(value);
#endif
}
// printf("get_env_var(%s) = %s\n", env_var, value_str.c_str());
return value_str;
}

Poco::SharedLibrary *
get_library()
{
static Poco::SharedLibrary * lib = nullptr;
if (!lib) {
std::string env_var = get_env_var("RMW_IMPLEMENTATION");
std::string env_var = rcpputils::get_env_var("RMW_IMPLEMENTATION");
if (env_var.empty()) {
env_var = STRINGIFY(DEFAULT_RMW_IMPLEMENTATION);
}
Expand Down Expand Up @@ -115,8 +90,6 @@ get_symbol(const char * symbol_name)
return lib->getSymbol(symbol_name);
}

} // namespace

#ifdef __cplusplus
extern "C"
{
Expand Down

0 comments on commit c4ccfbf

Please sign in to comment.