diff options
author | Andrew Bartlett <abartlet@samba.org> | 2019-08-22 10:59:07 +1200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2019-09-04 08:31:25 +0000 |
commit | 1bc9476be79b994a3a9b0618f23f176e399c5aaa (patch) | |
tree | 682e6531de7de8e909fbee1a990713b4a5a335ce /lib | |
parent | 0f993c094ea242934766761389cecd5ecfd14a37 (diff) | |
download | samba-1bc9476be79b994a3a9b0618f23f176e399c5aaa.tar.gz |
ldb: Rework all pointer NULL tests to use Samba's normal style
Also avoid if () without braces
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry picked from commit 3f290e95c2c133eb2c983ecc984d3dff4809f3d3)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ldb/common/ldb_dn.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c index a7fb0d9c443..377dd74d9f3 100644 --- a/lib/ldb/common/ldb_dn.c +++ b/lib/ldb/common/ldb_dn.c @@ -298,19 +298,21 @@ static bool ldb_dn_explode(struct ldb_dn *dn) char *parse_dn; bool is_index; - if ( ! dn || dn->invalid) return false; + if (dn == NULL || dn->invalid) { + return false; + } - if (dn->components) { + if (dn->components != NULL) { return true; } - if (dn->ext_linearized) { + if (dn->ext_linearized != NULL) { parse_dn = dn->ext_linearized; } else { parse_dn = dn->linearized; } - if ( ! parse_dn ) { + if (parse_dn == NULL) { return false; } @@ -333,13 +335,13 @@ static bool ldb_dn_explode(struct ldb_dn *dn) /* in the common case we have 3 or more components */ /* make sure all components are zeroed, other functions depend on it */ dn->components = talloc_zero_array(dn, struct ldb_dn_component, 3); - if ( ! dn->components) { + if (dn->components == NULL) { return false; } /* Components data space is allocated here once */ data = talloc_array(dn->components, char, strlen(parse_dn) + 1); - if (!data) { + if (data == NULL) { goto failed; } @@ -403,7 +405,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn) dn->ext_components = ext_comp; ext_syntax = ldb_dn_extended_syntax_by_name(dn->ldb, ex_name); - if (!ext_syntax) { + if (ext_syntax == NULL) { /* We don't know about this type of extended DN */ goto failed; } @@ -486,7 +488,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn) * with spaces trimmed) */ *d++ = '\0'; dn->components[dn->comp_num].name = talloc_strdup(dn->components, dt); - if ( ! dn->components[dn->comp_num].name) { + if (dn->components[dn->comp_num].name == NULL) { /* ouch */ goto failed; } @@ -564,7 +566,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn) } /* ok found value terminator */ - if ( t ) { + if (t != NULL) { /* trim back */ d -= (p - t); l -= (p - t); @@ -585,7 +587,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn) dn->components[dn->comp_num].value.data = \ (uint8_t *)talloc_memdup(dn->components, dt, l + 1); dn->components[dn->comp_num].value.length = l; - if ( ! dn->components[dn->comp_num].value.data) { + if (dn->components[dn->comp_num].value.data == NULL) { /* ouch ! */ goto failed; } @@ -600,7 +602,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn) dn->components, struct ldb_dn_component, dn->comp_num + 1); - if ( ! dn->components) { + if (dn->components == NULL) { /* ouch ! */ goto failed; } @@ -618,7 +620,9 @@ static bool ldb_dn_explode(struct ldb_dn *dn) values, which contain a '+' or '=' which should normally be escaped */ if (is_index) { - if ( t ) t = NULL; + if (t != NULL) { + t = NULL; + } *d++ = *p++; l++; break; @@ -639,7 +643,9 @@ static bool ldb_dn_explode(struct ldb_dn *dn) *d++ = *p++; l++; - if ( t ) t = NULL; + if (t != NULL) { + t = NULL; + } break; case '\\': @@ -653,7 +659,9 @@ static bool ldb_dn_explode(struct ldb_dn *dn) *d++ = *p++; l++; - if ( t ) t = NULL; + if (t != NULL) { + t = NULL; + } break; default: @@ -672,14 +680,20 @@ static bool ldb_dn_explode(struct ldb_dn *dn) escape = false; l++; - if ( t ) t = NULL; + if (t != NULL) { + t = NULL; + } break; } if (*p == ' ') { - if ( ! t) t = p; + if (t == NULL) { + t = p; + } } else { - if ( t ) t = NULL; + if (t != NULL) { + t = NULL; + } } *d++ = *p++; @@ -699,7 +713,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn) if (in_value) { /* save last element */ - if ( t ) { + if (t != NULL) { /* trim back */ d -= (p - t); l -= (p - t); @@ -714,7 +728,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn) dn->components[dn->comp_num].value.length = l; dn->components[dn->comp_num].value.data = (uint8_t *)talloc_memdup(dn->components, dt, l + 1); - if ( ! dn->components[dn->comp_num].value.data) { + if (dn->components[dn->comp_num].value.data == NULL) { /* ouch */ goto failed; } |