diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-07-18 11:23:08 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-07-24 13:35:11 +0200 |
commit | 7e91e82044f8d23acfb9949a2cdd667a6b239acd (patch) | |
tree | 4b6e393175aa5086df8a149684b644696c3fec5b /qtest.c | |
parent | c42e8742f527476839bcc5f91c3d2ea456ca6a45 (diff) |
hmp: Clean up and simplify hmp_migrate_set_parameter()
The bulk of hmp_migrate_set_parameter()'s code sets one member of
MigrationParameters according to the command's arguments. It uses a
string visitor for integer and boolean members, but not for string and
size members. It calls visit_type_bool() right away, but delays
visit_type_int() some. The delaying requires a flag variable and a
bit of trickery: we set all integer members instead of just the one we
want, and rely on the has_FOOs to mask the unwanted ones.
Clean this up as follows. Don't delay calling visit_type_int(). Use
the string visitor for strings, too. This involves extra allocations
and cleanup, but doing them is simpler and cleaner than avoiding them.
Sadly, using the string visitor for sizes isn't possible, because it
defaults to Bytes rather than Mebibytes. Add a comment explaining
that.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'qtest.c')
0 files changed, 0 insertions, 0 deletions