lib/util: untangle assignent from check in strhex_to_str()
authorMichael Adam <obnox@samba.org>
Tue, 18 Oct 2011 16:03:10 +0000 (18:03 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 18 Oct 2011 18:58:26 +0000 (20:58 +0200)
lib/util/util.c

index b700f372c732a1c2bdde35697bc37c89aaad8388..c5ed6fd0c797bb35a411769625d569a92acd6a3e 100644 (file)
@@ -712,13 +712,17 @@ _PUBLIC_ size_t strhex_to_str(char *p, size_t p_len, const char *strhex, size_t
        }
 
        for (; i < strhex_len && strhex[i] != 0; i++) {
-               if (!(p1 = strchr(hexchars, toupper((unsigned char)strhex[i]))))
+               p1 = strchr(hexchars, toupper((unsigned char)strhex[i]));
+               if (p1 == NULL) {
                        break;
+               }
 
                i++; /* next hex digit */
 
-               if (!(p2 = strchr(hexchars, toupper((unsigned char)strhex[i]))))
+               p2 = strchr(hexchars, toupper((unsigned char)strhex[i]));
+               if (p2 == NULL) {
                        break;
+               }
 
                /* get the two nybbles */
                hinybble = PTR_DIFF(p1, hexchars);