vmstate: check subsection_found is enough
PATCH 1/1 vmstate: check subsection_found is enough
subsection_found is true implies vmdesc is not NULL.
--- migration/vmstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration/vmstate.c +1 -1
@@ -533,7 +533,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, sub++; } -if (vmdesc && subsection_found) { +if (subsection_found) {json_end_array (vmdesc); }
Signature · 1 line
2.19.1
Quoted 12 lines · * Wei Yang ([email protected]) wrote:
subsection_foundis true implies vmdesc is not NULL.Signed-off-by Wei Yang <[email protected]>--- migration/vmstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/vmstate.c +0
-0
migration/vmstate.c static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, · line 536
Quoted 5 lines
migration/vmstate.c +1
-1@@ -533,7 +533,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, sub++; } -if (vmdesc && subsection_found) { +if (subsection_found) {
That's true, however it's not obvious from the names; I think we should probably rename 'subsection_found' to something like 'vmdesc_has_subsections' then it's more obvious that subsection_found is more specialised in this routine.
Dave
Quoted 6 lines
migration/vmstate.c +0
-0json_end_array (vmdesc); }Signature · 1 line
2.19.1
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 16 lines · Dr. David Alan Gilbert
Quoted 15 lines · * Wei Yang ([email protected]) wrote:
subsection_foundis true implies vmdesc is not NULL.Signed-off-by Wei Yang <[email protected]>--- migration/vmstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/vmstate.c +0
-0@@ -533,7 +533,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, sub++; }
Quoted 7 lines
migration/vmstate.c static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, · line 536
Quoted 2 lines
migration/vmstate.c +1
-1-if (vmdesc && subsection_found) { +if (subsection_found) {That's true, however it's not obvious from the names; I think we should probably rename '
subsection_found' to something like 'vmdesc_has_subsections' then it's more obvious thatsubsection_foundis more specialised in this routine.
Reasonable, let me change it :-)
Quoted 12 lines
Dave
Quoted 6 lines
migration/vmstate.c +0
-0json_end_array (vmdesc); }Signature · 1 line
2.19.1--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Signature · 2 lines
Wei Yang Help you, Help me