diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2023-12-21 14:15:42 +1100 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2023-12-29 11:17:30 +1100 |
commit | 2027001919f588e54185eb23214c312f6e1298e2 (patch) | |
tree | b585b545d70bb2f0bc7f0bb9130d513bff3d300d /migration/vmstate.c | |
parent | 7425b6277f12e82952cede1f531bfc689bf77fb1 (diff) |
migration: Make VMStateDescription.subsections const
Allow the array of pointers to itself be const.
Propagate this through the copies of this field.
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231221031652.119827-2-richard.henderson@linaro.org>
Diffstat (limited to 'migration/vmstate.c')
-rw-r--r-- | migration/vmstate.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/migration/vmstate.c b/migration/vmstate.c index b7723a4187..ef26f26ccd 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -452,13 +452,15 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, } 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) { + for (const VMStateDescription *s = *sub; s ; s = *++sub) { + if (strcmp(idstr, s->name) == 0) { + return s; + } } - sub++; } return NULL; } @@ -517,7 +519,7 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, JSONWriter *vmdesc) { - const VMStateDescription **sub = vmsd->subsections; + const VMStateDescription * const *sub = vmsd->subsections; bool vmdesc_has_subsections = false; int ret = 0; |