@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
static struct option long_options[] = {
{ .name = "ib-dev", .has_arg = 1, .val = 'd' },
{ .name = "help", .has_arg = 0, .val = 'h' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "d:h", long_options, NULL);
@@ -731,7 +731,7 @@ int main(int argc, char *argv[])
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
{ .name = "odp", .has_arg = 0, .val = 'o' },
{ .name = "ts", .has_arg = 0, .val = 't' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "p:d:i:s:m:r:n:l:eg:ot",
@@ -665,7 +665,7 @@ int main(int argc, char *argv[])
{ .name = "sl", .has_arg = 1, .val = 'l' },
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "p:d:i:s:m:q:r:n:l:eg:",
@@ -568,7 +568,7 @@ int main(int argc, char *argv[])
{ .name = "sl", .has_arg = 1, .val = 'l' },
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "p:d:i:s:m:r:n:l:eg:",
@@ -324,7 +324,7 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
}
{
- struct ibv_port_attr port_info = { 0 };
+ struct ibv_port_attr port_info = {};
int mtu;
if (ibv_query_port(ctx->context, port, &port_info)) {
@@ -588,7 +588,7 @@ int main(int argc, char *argv[])
{ .name = "sl", .has_arg = 1, .val = 'l' },
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "p:d:i:s:r:n:l:eg:",
@@ -875,7 +875,7 @@ int main(int argc, char *argv[])
{ .name = "sl", .has_arg = 1, .val = 'l' },
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "p:d:i:s:m:c:n:l:eg:", long_options,
@@ -1561,8 +1561,8 @@ mlx5_open_xrcd(struct ibv_context *context,
{
int err;
struct verbs_xrcd *xrcd;
- struct ibv_open_xrcd cmd = {0};
- struct ibv_open_xrcd_resp resp = {0};
+ struct ibv_open_xrcd cmd = {};
+ struct ibv_open_xrcd_resp resp = {};
xrcd = calloc(1, sizeof(*xrcd));
if (!xrcd)
The canonical way to zero fill a struct is {}. Sometimes people will write this as {0} which does the same thing if the first struct member is integral. However the preference for {} is because it allows the compiler to see that the intent is for every member to be zero, and this is not an inadvertent incomplete initialization of an array or struct. We have a random jumble of both styles, so lets prefer {} since it avoids a useful warning. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> --- libibverbs/examples/asyncwatch.c | 2 +- libibverbs/examples/rc_pingpong.c | 2 +- libibverbs/examples/srq_pingpong.c | 2 +- libibverbs/examples/uc_pingpong.c | 2 +- libibverbs/examples/ud_pingpong.c | 4 ++-- libibverbs/examples/xsrq_pingpong.c | 2 +- libmlx5/src/verbs.c | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-)