Skip to contentSkip to conversation

vmstate: check subsection_found is enough

PATCH Superseded Wei Yang 2 participants 3 messages Apr 2, 2019 – Apr 3, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

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
index e2bbb7b5f7..8327179eea 100644
@@ -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
#1 lore raw
Quoted 12 lines · * Wei Yang ([email protected]) wrote:

subsection_found is true implies vmdesc is not NULL.

---
 migration/vmstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/vmstate.c +0 -0
index e2bbb7b5f7..8327179eea 100644

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 -0
         json_end_array(vmdesc);
     }
 
Signature · 1 line
2.19.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

author
#2 lore raw
Quoted 16 lines · Dr. David Alan Gilbert
Quoted 15 lines · * Wei Yang ([email protected]) wrote:

subsection_found is true implies vmdesc is not NULL.

---
 migration/vmstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/vmstate.c +0 -0
index e2bbb7b5f7..8327179eea 100644
@@ -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 that subsection_found is more specialised in this routine.

Reasonable, let me change it :-)

Quoted 12 lines

Dave

Quoted 6 lines
migration/vmstate.c +0 -0
         json_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