[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 01/71] migration: Make VMStateDescription.subsections const
|
From: |
Juan Quintela |
|
Subject: |
Re: [PATCH 01/71] migration: Make VMStateDescription.subsections const |
|
Date: |
Mon, 06 Nov 2023 12:17:04 +0100 |
|
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) |
Richard Henderson <richard.henderson@linaro.org> wrote:
> Allow the array of pointers to itself be const.
> Propagate this through the copies of this field.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
> static const VMStateDescription *
> -vmstate_get_subsection(const VMStateDescription **sub, char *idstr)
> +vmstate_get_subsection(const VMStateDescription * const *sub,
> + const char *idstr)
> {
> - while (sub && *sub) {
> - if (strcmp(idstr, (*sub)->name) == 0) {
> - return *sub;
> + if (sub) {
> + const VMStateDescription *s;
> + for (s = *sub; s ; s = *++sub) {
If you have to resubmit, please consider:
for (const VMStateDescription *s = *sub; s ; s = *++sub) {
I think it makes clearer that the variable is not used out of the for.
- [PATCH 00/71] *: Constify VMState, Richard Henderson, 2023/11/06
- [PATCH 01/71] migration: Make VMStateDescription.subsections const, Richard Henderson, 2023/11/06
- [PATCH 03/71] targt/arm: Constify hvf/hvf.c, Richard Henderson, 2023/11/06
- [PATCH 04/71] target/alpha: Constify VMState in machine.c, Richard Henderson, 2023/11/06
- [PATCH 02/71] target/arm: Constify VMState in machine.c, Richard Henderson, 2023/11/06
- [PATCH 05/71] target/avr: Constify VMState in machine.c, Richard Henderson, 2023/11/06
- [PATCH 07/71] target/hppa: Constify VMState in machine.c, Richard Henderson, 2023/11/06