treewide: Drop unnecessary uses of memset/memcpy
Simply provide an initialiser or use a direct assignment instead.
Change-Id: I07385375cd8eec8a95874001b402b2c17ec09e09
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/55267
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71372
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/flashrom.c b/flashrom.c
index cbb9eab..26f2ca8 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -767,7 +767,7 @@
msg_gerr("Out of memory!\n");
exit(1);
}
- memcpy(flash->chip, chip, sizeof(*flash->chip));
+ *flash->chip = *chip;
flash->mst = mst;
if (map_flash(flash) != 0)
@@ -1558,11 +1558,9 @@
static void print_sysinfo(void)
{
#if IS_WINDOWS
- SYSTEM_INFO si;
- OSVERSIONINFOEX osvi;
+ SYSTEM_INFO si = { 0 };
+ OSVERSIONINFOEX osvi = { 0 };
- memset(&si, 0, sizeof(SYSTEM_INFO));
- memset(&osvi, 0, sizeof(OSVERSIONINFOEX));
msg_ginfo(" on Windows");
/* Tell Windows which version of the structure we want. */
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);