1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ldb: Prefer explicit initialization to ZERO_STRUCT()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-09-06 10:54:25 +12:00 committed by Andrew Bartlett
parent 238b5a8ad0
commit 477dc8f246

View File

@ -346,7 +346,7 @@ static int _ldb_msg_add_el(struct ldb_message *msg,
return LDB_ERR_OPERATIONS_ERROR;
}
ZERO_STRUCT(els[msg->num_elements]);
els[msg->num_elements] = (struct ldb_message_element) {};
msg->elements = els;
msg->num_elements++;
@ -848,7 +848,7 @@ int ldb_msg_find_attr_as_int(const struct ldb_message *msg,
int default_value)
{
const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
char buf[sizeof("-2147483648")];
char buf[sizeof("-2147483648")] = {};
char *end = NULL;
int ret;
@ -856,7 +856,6 @@ int ldb_msg_find_attr_as_int(const struct ldb_message *msg,
return default_value;
}
ZERO_STRUCT(buf);
if (v->length >= sizeof(buf)) {
return default_value;
}
@ -878,7 +877,7 @@ unsigned int ldb_msg_find_attr_as_uint(const struct ldb_message *msg,
unsigned int default_value)
{
const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
char buf[sizeof("-2147483648")];
char buf[sizeof("-2147483648")] = {};
char *end = NULL;
unsigned int ret;
@ -886,7 +885,6 @@ unsigned int ldb_msg_find_attr_as_uint(const struct ldb_message *msg,
return default_value;
}
ZERO_STRUCT(buf);
if (v->length >= sizeof(buf)) {
return default_value;
}
@ -919,7 +917,7 @@ int64_t ldb_msg_find_attr_as_int64(const struct ldb_message *msg,
int ldb_val_as_int64(const struct ldb_val *v, int64_t *val)
{
char buf[sizeof("-9223372036854775808")];
char buf[sizeof("-9223372036854775808")] = {};
char *end = NULL;
int64_t result;
@ -927,7 +925,6 @@ int ldb_val_as_int64(const struct ldb_val *v, int64_t *val)
return LDB_ERR_OPERATIONS_ERROR;
}
ZERO_STRUCT(buf);
if (v->length >= sizeof(buf)) {
return LDB_ERR_OPERATIONS_ERROR;
}
@ -958,7 +955,7 @@ uint64_t ldb_msg_find_attr_as_uint64(const struct ldb_message *msg,
int ldb_val_as_uint64(const struct ldb_val *v, uint64_t *val)
{
char buf[sizeof("-9223372036854775808")];
char buf[sizeof("-9223372036854775808")] = {};
char *end = NULL;
uint64_t result;
@ -966,7 +963,6 @@ int ldb_val_as_uint64(const struct ldb_val *v, uint64_t *val)
return LDB_ERR_OPERATIONS_ERROR;
}
ZERO_STRUCT(buf);
if (v->length >= sizeof(buf)) {
return LDB_ERR_OPERATIONS_ERROR;
}