aboutsummaryrefslogtreecommitdiff
path: root/util/log.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2016-07-01 13:47:47 +0200
committerMichael S. Tsirkin <mst@redhat.com>2016-07-04 16:49:33 +0300
commita0efbf16604770b9d805bcf210ec29942321134f (patch)
tree46e9cde32a5f519dab0d28f96a87ae74d4e72b4d /util/log.c
parent58e19e6e7914354242a67442d0006f9e31684d1a (diff)
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>
Diffstat (limited to 'util/log.c')
-rw-r--r--util/log.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/util/log.c b/util/log.c
index f811d6163b..4da635c8c9 100644
--- a/util/log.c
+++ b/util/log.c
@@ -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: