[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 12/16] util/guest-random: Clean up global variable shadowing
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 12/16] util/guest-random: Clean up global variable shadowing |
Date: |
Wed, 4 Oct 2023 14:00:15 +0200 |
Fix:
util/guest-random.c:90:45: error: declaration shadows a variable in the
global scope [-Werror,-Wshadow]
int qemu_guest_random_seed_main(const char *optarg, Error **errp)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/getopt.h:77:14:
note: previous declaration is here
extern char *optarg; /* getopt(3) external variables */
^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/qemu/guest-random.h | 8 ++++----
util/guest-random.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/qemu/guest-random.h b/include/qemu/guest-random.h
index 09ff9c2236..5060d49d60 100644
--- a/include/qemu/guest-random.h
+++ b/include/qemu/guest-random.h
@@ -13,16 +13,16 @@
#define QEMU_GUEST_RANDOM_H
/**
- * qemu_guest_random_seed_main(const char *optarg, Error **errp)
- * @optarg: a non-NULL pointer to a C string
+ * qemu_guest_random_seed_main(const char *seedstr, Error **errp)
+ * @seedstr: a non-NULL pointer to a C string
* @errp: an error indicator
*
- * The @optarg value is that which accompanies the -seed argument.
+ * The @seedstr value is that which accompanies the -seed argument.
* This forces qemu_guest_getrandom into deterministic mode.
*
* Returns 0 on success, < 0 on failure while setting *errp.
*/
-int qemu_guest_random_seed_main(const char *optarg, Error **errp);
+int qemu_guest_random_seed_main(const char *seedstr, Error **errp);
/**
* qemu_guest_random_seed_thread_part1(void)
diff --git a/util/guest-random.c b/util/guest-random.c
index 9465dda085..33607d5ff2 100644
--- a/util/guest-random.c
+++ b/util/guest-random.c
@@ -87,11 +87,11 @@ void qemu_guest_random_seed_thread_part2(uint64_t seed)
}
}
-int qemu_guest_random_seed_main(const char *optarg, Error **errp)
+int qemu_guest_random_seed_main(const char *seedstr, Error **errp)
{
uint64_t seed;
- if (parse_uint_full(optarg, 0, &seed)) {
- error_setg(errp, "Invalid seed number: %s", optarg);
+ if (parse_uint_full(seedstr, 0, &seed)) {
+ error_setg(errp, "Invalid seed number: %s", seedstr);
return -1;
} else {
deterministic = true;
--
2.41.0
- Re: [PATCH v3 14/16] softmmu/vl: Clean up global variable shadowing, (continued)
- [PATCH v3 15/16] sysemu/tpm: Clean up global variable shadowing, Philippe Mathieu-Daudé, 2023/10/04
- [PATCH v3 16/16] trace/control: Clean up global variable shadowing, Philippe Mathieu-Daudé, 2023/10/04
- [PATCH v3 06/16] qemu-img: Clean up global variable shadowing, Philippe Mathieu-Daudé, 2023/10/04
- [PATCH v3 10/16] ui/cocoa: Clean up global variable shadowing, Philippe Mathieu-Daudé, 2023/10/04
- [PATCH v3 12/16] util/guest-random: Clean up global variable shadowing,
Philippe Mathieu-Daudé <=
- Re: [PATCH v3 00/16] (few more) Steps towards enabling -Wshadow, Richard Henderson, 2023/10/04
- Re: [PATCH v3 00/16] (few more) Steps towards enabling -Wshadow, Markus Armbruster, 2023/10/06
- Re: [PATCH v3 00/16] (few more) Steps towards enabling -Wshadow, Markus Armbruster, 2023/10/06