dmidecode/0032-Rename-variable-div.patch
Lichen Liu 03b0d1462a
update to upstream fa268715
Resolves: RHEL-99252

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2025-10-14 13:48:30 +08:00

49 lines
1.4 KiB
Diff

From 29e3530402779142f9692142c61f2c596c0d54f9 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 6 Jun 2025 16:03:49 +0200
Subject: [PATCH 32/45] Rename variable "div"
On some systems, "div" is a global symbol, so for portability it's
better to avoid using that name for a local variable.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmidecode.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index 00d7343..92ee078 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -320,7 +320,7 @@ void dmi_print_memory_size(const char *attr, u64 code, int shift)
/* shift is 0 if the value is in bytes, 1 if it is in kB, 2 if it is in MB */
void dmi_print_storage_size(const char *attr, u64 code, unsigned int shift)
{
- u64 div;
+ u64 divisor;
static const char *unit[8] = {
"bytes", "kB", "MB", "GB", "TB", "PB", "EB", "ZB"
};
@@ -329,14 +329,14 @@ void dmi_print_storage_size(const char *attr, u64 code, unsigned int shift)
* We want to choose the unit which will let us display a number
* between 1.0 and 999.9.
*/
- div = 1;
- while (code / div >= 1000 && shift + 1 < ARRAY_SIZE(unit))
+ divisor = 1;
+ while (code / divisor >= 1000 && shift + 1 < ARRAY_SIZE(unit))
{
shift++;
- div *= 1000;
+ divisor *= 1000;
}
- pr_attr(attr, "%.1f %s", (float)code / div, unit[shift]);
+ pr_attr(attr, "%.1f %s", (float)code / divisor, unit[shift]);
}
/*
--
2.47.0