LP#1243841 - Wrap truth test using "=" in an extra set of parens.
authorChris Sharp <csharp@georgialibraries.org>
Tue, 19 Sep 2017 22:10:00 +0000 (18:10 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 7 May 2018 19:50:57 +0000 (15:50 -0400)
Referring to https://stackoverflow.com/questions/5476759/compiler-warning-suggest-parentheses-around-assignment-used-as-truth-value,
it is recommended to wrap variable assignments that are used as a truth
test within an extra set of parentheses.

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

src/libopensrf/osrf_cache.c

index 2f829cc..b9ef6e9 100644 (file)
@@ -60,7 +60,7 @@ char* _clean_key( const char* key ) {
     char* clean_key = (char*)strdup(key);
     char* d = clean_key;
     char* s = clean_key;
-    do while(isspace(*s) || ((*s != '\0') && iscntrl(*s))) s++; while(*d++ = *s++);
+    do while( (isspace(*s) || ((*s != '\0') && iscntrl(*s))) ) s++; while( (*d++ = *s++) );
     if (strlen(clean_key) > MAX_KEY_LEN) {
         char *hashed = md5sum(clean_key);
         clean_key[0] = '\0';