Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Getenv null check #399

Merged
merged 2 commits into from
Nov 30, 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
2 changes: 1 addition & 1 deletion source/SystemConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SystemConfig {
SystemConfig(const Any& any);

static SystemConfig load(String filename, bool saveJSON);
Any toAny(const bool forceAll = true) const;
Any toAny(const bool forceAll = false) const;
void printToLog(); // Print the latency logger config to log.txt

};
9 changes: 7 additions & 2 deletions source/SystemInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
SystemInfo SystemInfo::get(void) {
SystemInfo info;

info.hostName = getenv("COMPUTERNAME"); // Get the host (computer) name
info.userName = getenv("USERNAME"); // Get the current logged in username
char *ptr = getenv("COMPUTERNAME"); // Get the host (computer) name (if available)
if (notNull(ptr)) info.hostName = ptr;
else info.hostName = "unknown";

ptr = getenv("USERNAME"); // Get the current logged in username (if available)
if (notNull(ptr)) info.userName = ptr;
else info.userName = "unknown";

// Get CPU name string
int cpuInfo[4] = { -1 };
Expand Down
2 changes: 1 addition & 1 deletion source/SystemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ class SystemInfo {

static SystemInfo get(void); // Get the system info using (windows) calls

Any toAny(const bool forceAll = true) const;
Any toAny(const bool forceAll = false) const;
void printToLog();
};