summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2013-03-19 14:57:11 +0100
committerPatrick Ohly <patrick.ohly@intel.com>2013-03-19 14:57:11 +0100
commita69b9c904d1e4d1bb08a4acf6664a8f8ee477a6e (patch)
tree31b631b091c540871f566692735cc87cacf13132
parent3ec359deede05524ea67b85ee52fffda30c87dbc (diff)
testing: read env variable only once
Klocwork failed to detect that the result of getenv() was checked. Keep Klocwork happy by assigning the result to a temporary variable and checking that.
-rw-r--r--test/ClientTest.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/ClientTest.cpp b/test/ClientTest.cpp
index 5c2ec0df..6bbc3223 100644
--- a/test/ClientTest.cpp
+++ b/test/ClientTest.cpp
@@ -6413,7 +6413,8 @@ static string mangleICalendar20(const std::string &data, bool update, const std:
boost::replace_all(item, "UID:1234567890!@#$%^&*()<>@dummy", "UID:1234567890@dummy");
}
- if (getenv("CLIENT_TEST_UNIQUE_UID")) {
+ const char *uniqueUID = getenv("CLIENT_TEST_UNIQUE_UID");
+ if (uniqueUID) {
// Making UID unique per test to avoid issues
// when the source already holds older copies.
// Might still be an issue in real life?!
@@ -6425,7 +6426,7 @@ static string mangleICalendar20(const std::string &data, bool update, const std:
}
std::string unique = StringPrintf("UID:UNIQUE-UID-%llu-", (long long unsigned)start);
boost::replace_all(item, "UID:", unique);
- if (atoi(getenv("CLIENT_TEST_UNIQUE_UID")) > 1) {
+ if (atoi(uniqueUID) > 1) {
// Also avoid reusing the same UID inside the same test.
// Required by Google CalDAV in calendar testChanges, because
// they keep even deleted items around and check the SEQUENCE