Message ID | 20231102125023.166612-1-amusil@redhat.com |
---|---|
State | Accepted |
Delegated to: | Dumitru Ceara |
Headers | show |
Series | [ovs-dev] treewide: Avoid empty initializer | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/github-robot-_ovn-kubernetes | success | github build: passed |
+1, thanks for the cleanup. Reviewed-By: Ihar Hrachyshka <ihar@redhat.com> On Thu, Nov 2, 2023 at 8:50 AM Ales Musil <amusil@redhat.com> wrote: > 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> > --- > controller/ovn-controller.c | 2 +- > controller/pinctrl.c | 4 ++-- > lib/actions.c | 6 +++--- > northd/ovn-northd.c | 4 ++-- > 4 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c > index da7d145ed..a15280cb5 100644 > --- a/controller/ovn-controller.c > +++ b/controller/ovn-controller.c > @@ -4987,7 +4987,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. */ > diff --git a/controller/pinctrl.c b/controller/pinctrl.c > index 3c1cecfde..25b1f2933 100644 > --- a/controller/pinctrl.c > +++ b/controller/pinctrl.c > @@ -1310,7 +1310,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; > } > @@ -3788,7 +3788,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)); > diff --git a/lib/actions.c b/lib/actions.c > index b880927b6..a73fe1a1e 100644 > --- a/lib/actions.c > +++ b/lib/actions.c > @@ -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)); > @@ -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 { > @@ -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 { > diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c > index b2ec67c06..3ce737821 100644 > --- a/northd/ovn-northd.c > +++ b/northd/ovn-northd.c > @@ -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, > @@ -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(); > -- > 2.41.0 > >
On 11/2/23 15:40, Ihar Hrachyshka wrote: > +1, thanks for the cleanup. > > Reviewed-By: Ihar Hrachyshka <ihar@redhat.com> > Thanks, Ales and Ihar! Applied to main. Regards, Dumitru > On Thu, Nov 2, 2023 at 8:50 AM Ales Musil <amusil@redhat.com> wrote: > >> 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> >> --- >> controller/ovn-controller.c | 2 +- >> controller/pinctrl.c | 4 ++-- >> lib/actions.c | 6 +++--- >> northd/ovn-northd.c | 4 ++-- >> 4 files changed, 8 insertions(+), 8 deletions(-) >> >> diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c >> index da7d145ed..a15280cb5 100644 >> --- a/controller/ovn-controller.c >> +++ b/controller/ovn-controller.c >> @@ -4987,7 +4987,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. */ >> diff --git a/controller/pinctrl.c b/controller/pinctrl.c >> index 3c1cecfde..25b1f2933 100644 >> --- a/controller/pinctrl.c >> +++ b/controller/pinctrl.c >> @@ -1310,7 +1310,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; >> } >> @@ -3788,7 +3788,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)); >> diff --git a/lib/actions.c b/lib/actions.c >> index b880927b6..a73fe1a1e 100644 >> --- a/lib/actions.c >> +++ b/lib/actions.c >> @@ -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)); >> @@ -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 { >> @@ -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 { >> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c >> index b2ec67c06..3ce737821 100644 >> --- a/northd/ovn-northd.c >> +++ b/northd/ovn-northd.c >> @@ -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, >> @@ -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(); >> -- >> 2.41.0 >> >> >
diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index da7d145ed..a15280cb5 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -4987,7 +4987,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. */ diff --git a/controller/pinctrl.c b/controller/pinctrl.c index 3c1cecfde..25b1f2933 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -1310,7 +1310,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; } @@ -3788,7 +3788,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)); diff --git a/lib/actions.c b/lib/actions.c index b880927b6..a73fe1a1e 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -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)); @@ -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 { @@ -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 { diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index b2ec67c06..3ce737821 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -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, @@ -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();
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> --- controller/ovn-controller.c | 2 +- controller/pinctrl.c | 4 ++-- lib/actions.c | 6 +++--- northd/ovn-northd.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-)