Improving the clarity of the code
Callers of the function
pldm_bios_table_attr_value_entry_enum_decode_handles() provide the
pointer to the buffer and its size. Modifying the buffer size and using
it in the library can be error-prone. Adjust the code to only read the
buffer size and not to modify it.
Tested:
Unit Tests passed.
Change-Id: I26e843fa817e969719aa19f1922b4ea8622078f2
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/src/bios_table.c b/src/bios_table.c
index d5cc626..db1a6be 100644
--- a/src/bios_table.c
+++ b/src/bios_table.c
@@ -675,10 +675,10 @@
{
uint8_t curr_num =
pldm_bios_table_attr_value_entry_enum_decode_number(entry);
- number = number < curr_num ? number : curr_num;
- memcpy(handles, &entry->value[1], number);
+ curr_num = number < curr_num ? number : curr_num;
+ memcpy(handles, &entry->value[1], curr_num);
- return number;
+ return curr_num;
}
LIBPLDM_ABI_STABLE