]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ldb: Avoid "==true/false" in a boolean expression
authorVolker Lendecke <vl@samba.org>
Sun, 10 Apr 2022 16:22:55 +0000 (18:22 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 26 Apr 2022 21:41:29 +0000 (21:41 +0000)
That's what we have boolean variables and expressions for

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/ldb/common/ldb_dn.c

index cce5ad5b2ff04588771b61d2302431e234963ec4..fb7a95bf04fd4cfb1ff22cdd1864f24a32f4d21d 100644 (file)
@@ -298,7 +298,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
        char *parse_dn;
        bool is_index;
 
-       if (dn == NULL || dn->invalid == true) {
+       if (dn == NULL || dn->invalid) {
                return false;
        }
 
@@ -324,7 +324,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
        }
 
        /* Special DNs case */
-       if (dn->special == true) {
+       if (dn->special) {
                return true;
        }
 
@@ -350,7 +350,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
        d = dt = data;
 
        while (*p) {
-               if (in_extended == true) {
+               if (in_extended) {
 
                        if (!in_ex_name && !in_ex_value) {
 
@@ -437,8 +437,8 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
                        *d++ = *p++;
                        continue;
                }
-               if (in_attr == true) {
-                       if (trim == true) {
+               if (in_attr) {
+                       if (trim) {
                                if (*p == ' ') {
                                        p++;
                                        continue;
@@ -505,7 +505,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
                                goto failed;
                        }
 
-                       if (is_oid == true && ( ! (isdigit(*p) || (*p == '.')))) {
+                       if (is_oid && ( ! (isdigit(*p) || (*p == '.')))) {
                                /* not a digit nor a dot,
                                 * invalid attribute oid */
                                ldb_dn_mark_invalid(dn);
@@ -521,8 +521,8 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
                        continue;
                }
 
-               if (in_value == true) {
-                       if (in_quote == true) {
+               if (in_value) {
+                       if (in_quote) {
                                if (*p == '\"') {
                                        if (p[-1] != '\\') {
                                                p++;
@@ -535,7 +535,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
                                continue;
                        }
 
-                       if (trim == true) {
+                       if (trim) {
                                if (*p == ' ') {
                                        p++;
                                        continue;
@@ -558,7 +558,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
                        */
 
                        case ',':
-                               if (escape == true) {
+                               if (escape) {
                                        *d++ = *p++;
                                        l++;
                                        escape = false;
@@ -620,7 +620,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
                                accept the base64 encoded binary index
                                values, which contain a '+' or '='
                                which should normally be escaped */
-                               if (is_index == true) {
+                               if (is_index) {
                                        if (t != NULL) {
                                                t = NULL;
                                        }
@@ -635,7 +635,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
                        case '>':
                        case ';':
                                /* a string with not escaped specials is invalid (tested) */
-                               if (escape == false) {
+                               if (!escape) {
                                        ldb_dn_mark_invalid(dn);
                                        goto failed;
                                }
@@ -650,7 +650,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
                                break;
 
                        case '\\':
-                               if (escape == false) {
+                               if (!escape) {
                                        escape = true;
                                        p++;
                                        continue;
@@ -666,7 +666,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
                                break;
 
                        default:
-                               if (escape == true) {
+                               if (escape) {
                                        if (isxdigit(p[0]) && isxdigit(p[1])) {
                                                if (sscanf(p, "%02x", &x) != 1) {
                                                        /* invalid escaping sequence */
@@ -706,13 +706,13 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
                }
        }
 
-       if (in_attr == true || in_quote == true) {
+       if (in_attr || in_quote) {
                /* invalid dn */
                ldb_dn_mark_invalid(dn);
                goto failed;
        }
 
-       if (in_value == true) {
+       if (in_value) {
                /* save last element */
                if (t != NULL) {
                        /* trim back */