clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository[1] and reformat
the repository.
[1] https://gerrit.openbmc.org/c/openbmc/docs/+/63441
Further, shift the fixup for C's `_Static_assert` into src/msgbuf.h to
prevent a clang-tidy-16 error:
```
/data0/jenkins/workspace/ci-repository/openbmc/libpldm/src/msgbuf.h:315:2: error: '_Static_assert' is a C11 extension [clang-diagnostic-c11-extensions,-warnings-as-errors]
_Static_assert(sizeof(*dst) == sizeof(ldst),
^
```
And fix up the function prototype in the definition of `pldm_open()`:
```
../src/requester/pldm.c:128:16: error: a function declaration without a prototype is deprecated in all versions of C [clang-diagnostic-strict-prototypes,-warnings-as-errors]
void pldm_close()
^
void
```
Change-Id: I57b53f51914e39237e733d024e62ab41b3d306c1
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/src/transport/mctp-demux.c b/src/transport/mctp-demux.c
index 4b56f2f..4769827 100644
--- a/src/transport/mctp-demux.c
+++ b/src/transport/mctp-demux.c
@@ -113,8 +113,8 @@
return PLDM_REQUESTER_RECV_FAIL;
}
- ssize_t min_len =
- sizeof(eid) + sizeof(mctp_msg_type) + sizeof(struct pldm_msg_hdr);
+ ssize_t min_len = sizeof(eid) + sizeof(mctp_msg_type) +
+ sizeof(struct pldm_msg_hdr);
ssize_t length = recv(demux->socket, NULL, 0, MSG_PEEK | MSG_TRUNC);
if (length <= 0) {
return PLDM_REQUESTER_RECV_FAIL;
@@ -141,7 +141,7 @@
}
iov[1].iov_len = pldm_len;
iov[1].iov_base = *pldm_resp_msg;
- struct msghdr msg = {0};
+ struct msghdr msg = { 0 };
msg.msg_iov = iov;
msg.msg_iovlen = sizeof(iov) / sizeof(iov[0]);
ssize_t bytes = recvmsg(demux->socket, &msg, 0);
@@ -169,7 +169,7 @@
return PLDM_REQUESTER_SEND_FAIL;
}
- uint8_t hdr[2] = {eid, mctp_msg_type};
+ uint8_t hdr[2] = { eid, mctp_msg_type };
struct iovec iov[2];
iov[0].iov_base = hdr;
@@ -177,7 +177,7 @@
iov[1].iov_base = (uint8_t *)pldm_req_msg;
iov[1].iov_len = req_msg_len;
- struct msghdr msg = {0};
+ struct msghdr msg = { 0 };
msg.msg_iov = iov;
msg.msg_iovlen = sizeof(iov) / sizeof(iov[0]);
@@ -195,7 +195,7 @@
}
struct pldm_transport_mctp_demux *demux =
- calloc(1, sizeof(struct pldm_transport_mctp_demux));
+ calloc(1, sizeof(struct pldm_transport_mctp_demux));
if (!demux) {
return -ENOMEM;
}
@@ -228,7 +228,7 @@
pldm_transport_mctp_demux_init_with_fd(int mctp_fd)
{
struct pldm_transport_mctp_demux *demux =
- calloc(1, sizeof(struct pldm_transport_mctp_demux));
+ calloc(1, sizeof(struct pldm_transport_mctp_demux));
if (!demux) {
return NULL;
}
@@ -250,7 +250,7 @@
}
int pldm_transport_mctp_demux_get_socket_fd(
- struct pldm_transport_mctp_demux *ctx)
+ struct pldm_transport_mctp_demux *ctx)
{
if (ctx && ctx->socket) {
return ctx->socket;