Skip to content

Commit

Permalink
treewide: Avoid empty initializer
Browse files Browse the repository at this point in the history
The empty initializer (" = {}") is allowed only from
C23 and further [0]. Use the supported C99 compatible
method instead ("= {0}"). This shouldn't case any
trouble because both GCC and Clang generate the same
instructions for either of the initializers.

[0] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3054.pdf

Signed-off-by: Ales Musil <amusil@redhat.com>
Reviewed-By: Ihar Hrachyshka <ihar@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
  • Loading branch information
almusil authored and dceara committed Nov 17, 2023
1 parent 9e3a09f commit ef51c94
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion controller/ovn-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -4973,7 +4973,7 @@ int
main(int argc, char *argv[])
{
struct unixctl_server *unixctl;
struct ovn_exit_args exit_args = {};
struct ovn_exit_args exit_args = {0};
int retval;

/* Read from system-id-override file once on startup. */
Expand Down
4 changes: 2 additions & 2 deletions controller/pinctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ fill_ipv6_prefix_state(struct ovsdb_idl_txn *ovnsb_idl_txn,
pfd->prefix = in6addr_any;
}
} else if (pfd->state == PREFIX_PENDING && ovnsb_idl_txn) {
char prefix_str[INET6_ADDRSTRLEN + 1] = {};
char prefix_str[INET6_ADDRSTRLEN + 1] = {0};
if (!ipv6_string_mapped(prefix_str, &pfd->prefix)) {
goto out;
}
Expand Down Expand Up @@ -3797,7 +3797,7 @@ packet_put_ra_dnssl_opt(struct dp_packet *b, ovs_be32 lifetime,
char *dnssl_data)
{
size_t prev_l4_size = dp_packet_l4_size(b);
char dnssl[255] = {};
char dnssl[255] = {0};
int size;

size = encode_ra_dnssl_opt(dnssl_data, dnssl, sizeof(dnssl));
Expand Down
6 changes: 3 additions & 3 deletions lib/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -3439,7 +3439,7 @@ encode_put_nd_ra_option(const struct ovnact_gen_option *o,

case ND_OPT_DNSSL:
{
char dnssl[255] = {};
char dnssl[255] = {0};
int size;

size = encode_ra_dnssl_opt(c->string, dnssl, sizeof(dnssl));
Expand Down Expand Up @@ -4938,7 +4938,7 @@ format_COMMIT_LB_AFF(const struct ovnact_commit_lb_aff *lb_aff, struct ds *s)
bool ipv6 = !IN6_IS_ADDR_V4MAPPED(&lb_aff->vip);

if (ipv6) {
char ip_str[INET6_ADDRSTRLEN] = {};
char ip_str[INET6_ADDRSTRLEN] = {0};
inet_ntop(AF_INET6, &lb_aff->vip, ip_str, INET6_ADDRSTRLEN);
ds_put_format(s, "commit_lb_aff(vip = \"[%s]", ip_str);
} else {
Expand All @@ -4953,7 +4953,7 @@ format_COMMIT_LB_AFF(const struct ovnact_commit_lb_aff *lb_aff, struct ds *s)
ds_put_cstr(s, "\"");

if (ipv6) {
char ip_str[INET6_ADDRSTRLEN] = {};
char ip_str[INET6_ADDRSTRLEN] = {0};
inet_ntop(AF_INET6, &lb_aff->backend, ip_str, INET6_ADDRSTRLEN);
ds_put_format(s, ", backend = \"[%s]", ip_str);
} else {
Expand Down
4 changes: 2 additions & 2 deletions northd/ovn-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ main(int argc, char *argv[])
int res = EXIT_SUCCESS;
struct unixctl_server *unixctl;
int retval;
struct ovn_exit_args exit_args = {};
struct ovn_exit_args exit_args = {0};
int n_threads = 1;
struct northd_state state = {
.had_lock = false,
Expand Down Expand Up @@ -878,7 +878,7 @@ main(int argc, char *argv[])
run_update_worker_pool(n_threads);

/* Main loop. */
struct northd_engine_context eng_ctx = {};
struct northd_engine_context eng_ctx = {0};

while (!exit_args.exiting) {
update_ssl_config();
Expand Down

0 comments on commit ef51c94

Please sign in to comment.