diff options
author | Markus Armbruster <armbru@redhat.com> | 2016-07-01 13:47:47 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-07-04 16:49:33 +0300 |
commit | a0efbf16604770b9d805bcf210ec29942321134f (patch) | |
tree | 46e9cde32a5f519dab0d28f96a87ae74d4e72b4d /util/range.c | |
parent | 58e19e6e7914354242a67442d0006f9e31684d1a (diff) | |
download | qemu-a0efbf16604770b9d805bcf210ec29942321134f.zip |
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/range.c')
-rw-r--r-- | util/range.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/util/range.c b/util/range.c index e90c988dbf..e5f2e71142 100644 --- a/util/range.c +++ b/util/range.c @@ -46,8 +46,7 @@ GList *range_list_insert(GList *list, Range *data) { GList *l; - /* Range lists require no empty ranges */ - assert(data->begin < data->end || (data->begin && !data->end)); + assert(!range_is_empty(data)); /* Skip all list elements strictly less than data */ for (l = list; l && range_compare(l->data, data) < 0; l = l->next) { |