pdr: Inline add_record() and make_new_record() into pldm_pdr_add()

They only had a single call-site, in pldm_pdr_add(). Inlining the
functions improves readability by locality. The implementation doesn't
reach excessive lengths, and it improves insight into the current use of
assert() for argument validation.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I825420b5b9f25685baf10c8b20675cf22f1c8ee1
diff --git a/src/pdr.c b/src/pdr.c
index bbda618..094e1c6 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -34,23 +34,6 @@
 	return record->next->record_handle;
 }
 
-static void add_record(pldm_pdr *repo, pldm_pdr_record *record)
-{
-	assert(repo != NULL);
-	assert(record != NULL);
-
-	if (repo->first == NULL) {
-		assert(repo->last == NULL);
-		repo->first = record;
-		repo->last = record;
-	} else {
-		repo->last->next = record;
-		repo->last = record;
-	}
-	repo->size += record->size;
-	++repo->record_count;
-}
-
 static inline uint32_t get_new_record_handle(const pldm_pdr *repo)
 {
 	assert(repo != NULL);
@@ -61,16 +44,18 @@
 	return last_used_hdl + 1;
 }
 
-static pldm_pdr_record *make_new_record(const pldm_pdr *repo,
-					const uint8_t *data, uint32_t size,
-					uint32_t record_handle, bool is_remote,
-					uint16_t terminus_handle)
+LIBPLDM_ABI_STABLE
+uint32_t pldm_pdr_add(pldm_pdr *repo, const uint8_t *data, uint32_t size,
+		      uint32_t record_handle, bool is_remote,
+		      uint16_t terminus_handle)
 {
 	assert(repo != NULL);
+	assert(data != NULL);
 	assert(size != 0);
 
 	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;
@@ -95,20 +80,17 @@
 	}
 	record->next = NULL;
 
-	return record;
-}
+	if (repo->first == NULL) {
+		assert(repo->last == NULL);
+		repo->first = record;
+		repo->last = record;
+	} else {
+		repo->last->next = record;
+		repo->last = record;
+	}
 
-LIBPLDM_ABI_STABLE
-uint32_t pldm_pdr_add(pldm_pdr *repo, const uint8_t *data, uint32_t size,
-		      uint32_t record_handle, bool is_remote,
-		      uint16_t terminus_handle)
-{
-	assert(size != 0);
-	assert(data != NULL);
-
-	pldm_pdr_record *record = make_new_record(
-		repo, data, size, record_handle, is_remote, terminus_handle);
-	add_record(repo, record);
+	repo->size += record->size;
+	++repo->record_count;
 
 	return record->record_handle;
 }