Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

acl_profiler_test: fix undefined behaviour #196

Merged
merged 3 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/acl_profiler_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ MT_TEST_GROUP(acl_profile) {
enum { MAX_DEVICES = 100, m_num_devices_in_context = 3 };
void setup() {
if (threadNum() == 0) {
char profile_runtime_env_var[] = "ACL_RUNTIME_PROFILING_ACTIVE=1";
char profiler_timer_env_var[] = "ACL_PROFILE_TIMER=1";
static char profile_runtime_env_var[] = "ACL_RUNTIME_PROFILING_ACTIVE=1";
static char profiler_timer_env_var[] = "ACL_PROFILE_TIMER=1";
#ifdef _WIN32
_putenv(profile_runtime_env_var);
_putenv(profiler_timer_env_var);
Expand Down
17 changes: 3 additions & 14 deletions test/acl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,27 +188,16 @@ SimpleString StringFrom(size_t x) {
#endif

void acl_test_unsetenv(const char *var) {

#ifdef _WIN32
{
char buf[1000];
sprintf(buf, "%s=", var);
_putenv(buf);
}
_putenv_s(var, "");
#else
unsetenv(var);
#endif
if (acl_getenv(var)) {
*(char *)0 = 0;
}
}

void acl_test_setenv(const char *var, const char *value) {
#ifdef _WIN32
{
char buf[1000];
sprintf(buf, "%s=%s", var, value);
_putenv(buf);
}
_putenv_s(var, value);
#else
setenv(var, value, 1);
#endif
Expand Down