mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
range: Eliminate direct Range member access
Users of struct Range mess liberally with its members, which makes refactoring hard. Create a set of methods, and convert all users to call them instead of accessing members. The methods have carefully worded contracts, and use assertions to check them. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
58e19e6e79
commit
a0efbf1660
9 changed files with 176 additions and 74 deletions
|
@ -132,7 +132,7 @@ bool qemu_log_in_addr_range(uint64_t addr)
|
|||
int i = 0;
|
||||
for (i = 0; i < debug_regions->len; i++) {
|
||||
Range *range = &g_array_index(debug_regions, Range, i);
|
||||
if (addr >= range->begin && addr <= range->end - 1) {
|
||||
if (range_contains(range, addr)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -208,8 +208,7 @@ void qemu_set_dfilter_ranges(const char *filter_spec, Error **errp)
|
|||
error_setg(errp, "Invalid range");
|
||||
goto out;
|
||||
}
|
||||
range.begin = lob;
|
||||
range.end = upb + 1;
|
||||
range_set_bounds(&range, lob, upb);
|
||||
g_array_append_val(debug_regions, range);
|
||||
}
|
||||
out:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue