qemu-devel
[Top][All Lists]
Advanced

[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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]