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/pdr.c b/src/pdr.c
index 2fe9e7b..232dd89 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -54,7 +54,7 @@
 {
 	assert(repo != NULL);
 	uint32_t last_used_hdl =
-	    repo->last != NULL ? repo->last->record_handle : 0;
+		repo->last != NULL ? repo->last->record_handle : 0;
 	assert(last_used_hdl != UINT32_MAX);
 
 	return last_used_hdl + 1;
@@ -70,8 +70,9 @@
 
 	pldm_pdr_record *record = malloc(sizeof(pldm_pdr_record));
 	assert(record != NULL);
-	record->record_handle =
-	    record_handle == 0 ? get_new_record_handle(repo) : record_handle;
+	record->record_handle = record_handle == 0 ?
+					get_new_record_handle(repo) :
+					record_handle;
 	record->size = size;
 	record->is_remote = is_remote;
 	record->terminus_handle = terminus_handle;
@@ -87,7 +88,7 @@
 		 */
 		if (!record_handle) {
 			struct pldm_pdr_hdr *hdr =
-			    (struct pldm_pdr_hdr *)(record->data);
+				(struct pldm_pdr_hdr *)(record->data);
 			hdr->record_handle = htole32(record->record_handle);
 		}
 	}
@@ -104,7 +105,7 @@
 	assert(data != NULL);
 
 	pldm_pdr_record *record = make_new_record(
-	    repo, data, size, record_handle, is_remote, terminus_handle);
+		repo, data, size, record_handle, is_remote, terminus_handle);
 	add_record(repo, record);
 
 	return record->record_handle;
@@ -158,7 +159,7 @@
 			*size = record->size;
 			*data = record->data;
 			*next_record_handle =
-			    get_next_record_handle(repo, record);
+				get_next_record_handle(repo, record);
 			return record;
 		}
 		record = record->next;
@@ -269,8 +270,8 @@
 	hdr->record_change_num = 0;
 	hdr->length = htole16(sizeof(struct pldm_pdr_fru_record_set));
 	struct pldm_pdr_fru_record_set *fru =
-	    (struct pldm_pdr_fru_record_set *)((uint8_t *)hdr +
-					       sizeof(struct pldm_pdr_hdr));
+		(struct pldm_pdr_fru_record_set *)((uint8_t *)hdr +
+						   sizeof(struct pldm_pdr_hdr));
 	fru->terminus_handle = htole16(terminus_handle);
 	fru->fru_rsi = htole16(fru_rsi);
 	fru->entity_type = htole16(entity_type);
@@ -282,9 +283,9 @@
 }
 
 const pldm_pdr_record *pldm_pdr_fru_record_set_find_by_rsi(
-    const pldm_pdr *repo, uint16_t fru_rsi, uint16_t *terminus_handle,
-    uint16_t *entity_type, uint16_t *entity_instance_num,
-    uint16_t *container_id)
+	const pldm_pdr *repo, uint16_t fru_rsi, uint16_t *terminus_handle,
+	uint16_t *entity_type, uint16_t *entity_instance_num,
+	uint16_t *container_id)
 {
 	assert(terminus_handle != NULL);
 	assert(entity_type != NULL);
@@ -294,22 +295,23 @@
 	uint8_t *data = NULL;
 	uint32_t size = 0;
 	const pldm_pdr_record *curr_record = pldm_pdr_find_record_by_type(
-	    repo, PLDM_PDR_FRU_RECORD_SET, NULL, &data, &size);
+		repo, PLDM_PDR_FRU_RECORD_SET, NULL, &data, &size);
 	while (curr_record != NULL) {
 		struct pldm_pdr_fru_record_set *fru =
-		    (struct pldm_pdr_fru_record_set
-			 *)(data + sizeof(struct pldm_pdr_hdr));
+			(struct pldm_pdr_fru_record_set
+				 *)(data + sizeof(struct pldm_pdr_hdr));
 		if (fru->fru_rsi == htole16(fru_rsi)) {
 			*terminus_handle = le16toh(fru->terminus_handle);
 			*entity_type = le16toh(fru->entity_type);
 			*entity_instance_num =
-			    le16toh(fru->entity_instance_num);
+				le16toh(fru->entity_instance_num);
 			*container_id = le16toh(fru->container_id);
 			return curr_record;
 		}
 		data = NULL;
 		curr_record = pldm_pdr_find_record_by_type(
-		    repo, PLDM_PDR_FRU_RECORD_SET, curr_record, &data, &size);
+			repo, PLDM_PDR_FRU_RECORD_SET, curr_record, &data,
+			&size);
 	}
 
 	*terminus_handle = 0;
@@ -333,18 +335,19 @@
 	do {
 		if (record != NULL) {
 			struct pldm_terminus_locator_pdr *pdr =
-			    (struct pldm_terminus_locator_pdr *)out_data;
+				(struct pldm_terminus_locator_pdr *)out_data;
 			struct pldm_terminus_locator_type_mctp_eid *value =
-			    (struct pldm_terminus_locator_type_mctp_eid *)
-				pdr->terminus_locator_value;
+				(struct pldm_terminus_locator_type_mctp_eid *)
+					pdr->terminus_locator_value;
 			if (pdr->terminus_handle == terminus_handle &&
 			    pdr->tid == tid && value->eid == tl_eid) {
 				pdr->validity = valid_bit;
 				break;
 			}
 		}
-		record = pldm_pdr_find_record_by_type(
-		    repo, PLDM_TERMINUS_LOCATOR_PDR, record, &out_data, &size);
+		record = pldm_pdr_find_record_by_type(repo,
+						      PLDM_TERMINUS_LOCATOR_PDR,
+						      record, &out_data, &size);
 	} while (record);
 }
 
@@ -379,7 +382,7 @@
 pldm_entity_association_tree *pldm_entity_association_tree_init(void)
 {
 	pldm_entity_association_tree *tree =
-	    malloc(sizeof(pldm_entity_association_tree));
+		malloc(sizeof(pldm_entity_association_tree));
 	assert(tree != NULL);
 	tree->root = NULL;
 	tree->last_used_container_id = 0;
@@ -409,9 +412,9 @@
 }
 
 pldm_entity_node *pldm_entity_association_tree_add(
-    pldm_entity_association_tree *tree, pldm_entity *entity,
-    uint16_t entity_instance_number, pldm_entity_node *parent,
-    uint8_t association_type)
+	pldm_entity_association_tree *tree, pldm_entity *entity,
+	uint16_t entity_instance_number, pldm_entity_node *parent,
+	uint8_t association_type)
 {
 	assert(tree != NULL);
 	assert(entity != NULL);
@@ -436,7 +439,7 @@
 	node->parent.entity_container_id = 0;
 	node->entity.entity_type = entity->entity_type;
 	node->entity.entity_instance_num =
-	    entity_instance_number != 0xFFFF ? entity_instance_number : 1;
+		entity_instance_number != 0xFFFF ? entity_instance_number : 1;
 	node->association_type = association_type;
 
 	if (tree->root == NULL) {
@@ -449,24 +452,24 @@
 		node->parent = parent->entity;
 		node->entity.entity_container_id = next_container_id(tree);
 	} else {
-		pldm_entity_node *start =
-		    parent == NULL ? tree->root : parent->first_child;
+		pldm_entity_node *start = parent == NULL ? tree->root :
+							   parent->first_child;
 		pldm_entity_node *prev =
-		    find_insertion_at(start, entity->entity_type);
+			find_insertion_at(start, entity->entity_type);
 		assert(prev != NULL);
 		pldm_entity_node *next = prev->next_sibling;
 		if (prev->entity.entity_type == entity->entity_type) {
 			assert(prev->entity.entity_instance_num != UINT16_MAX);
 			node->entity.entity_instance_num =
-			    entity_instance_number != 0xFFFF
-				? entity_instance_number
-				: prev->entity.entity_instance_num + 1;
+				entity_instance_number != 0xFFFF ?
+					entity_instance_number :
+					prev->entity.entity_instance_num + 1;
 		}
 		prev->next_sibling = node;
 		node->parent = prev->parent;
 		node->next_sibling = next;
 		node->entity.entity_container_id =
-		    prev->entity.entity_container_id;
+			prev->entity.entity_container_id;
 	}
 	entity->entity_instance_num = node->entity.entity_instance_num;
 	entity->entity_container_id = node->entity.entity_container_id;
@@ -593,8 +596,7 @@
 	while (curr != NULL) {
 		if (node->entity_type == curr->entity.entity_type &&
 		    node->entity_instance_num ==
-			curr->entity.entity_instance_num) {
-
+			    curr->entity.entity_instance_num) {
 			return true;
 		}
 		curr = curr->next_sibling;
@@ -642,9 +644,9 @@
 			pldm_entity *entity = (pldm_entity *)start;
 			entity->entity_type = htole16(node->entity.entity_type);
 			entity->entity_instance_num =
-			    htole16(node->entity.entity_instance_num);
+				htole16(node->entity.entity_instance_num);
 			entity->entity_container_id =
-			    htole16(node->entity.entity_container_id);
+				htole16(node->entity.entity_container_id);
 			start += sizeof(pldm_entity);
 		}
 		node = node->next_sibling;
@@ -657,30 +659,33 @@
 					     pldm_pdr *repo, bool is_remote,
 					     uint16_t terminus_handle)
 {
-	uint8_t num_logical_children =
-	    pldm_entity_get_num_children(curr, PLDM_ENTITY_ASSOCIAION_LOGICAL);
-	uint8_t num_physical_children =
-	    pldm_entity_get_num_children(curr, PLDM_ENTITY_ASSOCIAION_PHYSICAL);
+	uint8_t num_logical_children = pldm_entity_get_num_children(
+		curr, PLDM_ENTITY_ASSOCIAION_LOGICAL);
+	uint8_t num_physical_children = pldm_entity_get_num_children(
+		curr, PLDM_ENTITY_ASSOCIAION_PHYSICAL);
 
 	if (num_logical_children) {
 		uint16_t logical_pdr_size =
-		    sizeof(struct pldm_pdr_hdr) + sizeof(uint16_t) +
-		    sizeof(uint8_t) + sizeof(pldm_entity) + sizeof(uint8_t) +
-		    (num_logical_children * sizeof(pldm_entity));
+			sizeof(struct pldm_pdr_hdr) + sizeof(uint16_t) +
+			sizeof(uint8_t) + sizeof(pldm_entity) +
+			sizeof(uint8_t) +
+			(num_logical_children * sizeof(pldm_entity));
 		entity_association_pdr_add_children(
-		    curr, repo, logical_pdr_size, num_logical_children,
-		    PLDM_ENTITY_ASSOCIAION_LOGICAL, is_remote, terminus_handle);
+			curr, repo, logical_pdr_size, num_logical_children,
+			PLDM_ENTITY_ASSOCIAION_LOGICAL, is_remote,
+			terminus_handle);
 	}
 
 	if (num_physical_children) {
 		uint16_t physical_pdr_size =
-		    sizeof(struct pldm_pdr_hdr) + sizeof(uint16_t) +
-		    sizeof(uint8_t) + sizeof(pldm_entity) + sizeof(uint8_t) +
-		    (num_physical_children * sizeof(pldm_entity));
+			sizeof(struct pldm_pdr_hdr) + sizeof(uint16_t) +
+			sizeof(uint8_t) + sizeof(pldm_entity) +
+			sizeof(uint8_t) +
+			(num_physical_children * sizeof(pldm_entity));
 		entity_association_pdr_add_children(
-		    curr, repo, physical_pdr_size, num_physical_children,
-		    PLDM_ENTITY_ASSOCIAION_PHYSICAL, is_remote,
-		    terminus_handle);
+			curr, repo, physical_pdr_size, num_physical_children,
+			PLDM_ENTITY_ASSOCIAION_PHYSICAL, is_remote,
+			terminus_handle);
 	}
 }
 
@@ -731,8 +736,8 @@
 }
 
 void pldm_entity_association_pdr_add_from_node(
-    pldm_entity_node *node, pldm_pdr *repo, pldm_entity **entities,
-    size_t num_entities, bool is_remote, uint16_t terminus_handle)
+	pldm_entity_node *node, pldm_pdr *repo, pldm_entity **entities,
+	size_t num_entities, bool is_remote, uint16_t terminus_handle)
 {
 	assert(repo != NULL);
 
@@ -749,7 +754,7 @@
 
 	if (tree_node->entity.entity_type == entity.entity_type &&
 	    tree_node->entity.entity_instance_num ==
-		entity.entity_instance_num) {
+		    entity.entity_instance_num) {
 		*node = tree_node;
 		return;
 	}
@@ -804,9 +809,9 @@
 			record->record_handle = ++record_handle;
 			if (record->data != NULL) {
 				struct pldm_pdr_hdr *hdr =
-				    (struct pldm_pdr_hdr *)(record->data);
+					(struct pldm_pdr_hdr *)(record->data);
 				hdr->record_handle =
-				    htole32(record->record_handle);
+					htole32(record->record_handle);
 			}
 			record = record->next;
 		}
@@ -850,9 +855,9 @@
 			record->record_handle = ++record_handle;
 			if (record->data != NULL) {
 				struct pldm_pdr_hdr *hdr =
-				    (struct pldm_pdr_hdr *)(record->data);
+					(struct pldm_pdr_hdr *)(record->data);
 				hdr->record_handle =
-				    htole32(record->record_handle);
+					htole32(record->record_handle);
 			}
 			record = record->next;
 		}
@@ -907,15 +912,15 @@
 }
 
 void pldm_entity_association_tree_copy_root(
-    pldm_entity_association_tree *org_tree,
-    pldm_entity_association_tree *new_tree)
+	pldm_entity_association_tree *org_tree,
+	pldm_entity_association_tree *new_tree)
 {
 	new_tree->last_used_container_id = org_tree->last_used_container_id;
 	entity_association_tree_copy(org_tree->root, &(new_tree->root));
 }
 
 void pldm_entity_association_tree_destroy_root(
-    pldm_entity_association_tree *tree)
+	pldm_entity_association_tree *tree)
 {
 	assert(tree != NULL);
 	entity_association_tree_destroy(tree->root);
@@ -934,39 +939,39 @@
 {
 	assert(pdr != NULL);
 	assert(pdr_len >= sizeof(struct pldm_pdr_hdr) +
-			      sizeof(struct pldm_pdr_entity_association));
+				  sizeof(struct pldm_pdr_entity_association));
 
 	struct pldm_pdr_hdr *hdr = (struct pldm_pdr_hdr *)pdr;
 	assert(hdr->type == PLDM_PDR_ENTITY_ASSOCIATION);
 
 	const uint8_t *start = (uint8_t *)pdr;
 	const uint8_t *end =
-	    start + sizeof(struct pldm_pdr_hdr) + le16toh(hdr->length);
+		start + sizeof(struct pldm_pdr_hdr) + le16toh(hdr->length);
 	start += sizeof(struct pldm_pdr_hdr);
 	struct pldm_pdr_entity_association *entity_association_pdr =
-	    (struct pldm_pdr_entity_association *)start;
+		(struct pldm_pdr_entity_association *)start;
 	*num_entities = entity_association_pdr->num_children + 1;
 	assert(*num_entities >= 2);
 	*entities = malloc(sizeof(pldm_entity) * *num_entities);
 	assert(*entities != NULL);
 	assert(start + sizeof(struct pldm_pdr_entity_association) +
-		   sizeof(pldm_entity) * (*num_entities - 2) ==
+		       sizeof(pldm_entity) * (*num_entities - 2) ==
 	       end);
 	(*entities)->entity_type =
-	    le16toh(entity_association_pdr->container.entity_type);
+		le16toh(entity_association_pdr->container.entity_type);
 	(*entities)->entity_instance_num =
-	    le16toh(entity_association_pdr->container.entity_instance_num);
+		le16toh(entity_association_pdr->container.entity_instance_num);
 	(*entities)->entity_container_id =
-	    le16toh(entity_association_pdr->container.entity_container_id);
+		le16toh(entity_association_pdr->container.entity_container_id);
 	pldm_entity *curr_entity = entity_association_pdr->children;
 	size_t i = 1;
 	while (i < *num_entities) {
 		(*entities + i)->entity_type =
-		    le16toh(curr_entity->entity_type);
+			le16toh(curr_entity->entity_type);
 		(*entities + i)->entity_instance_num =
-		    le16toh(curr_entity->entity_instance_num);
+			le16toh(curr_entity->entity_instance_num);
 		(*entities + i)->entity_container_id =
-		    le16toh(curr_entity->entity_container_id);
+			le16toh(curr_entity->entity_container_id);
 		++curr_entity;
 		++i;
 	}