aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2018-10-23 17:23:02 +0200
committerEduardo Habkost <ehabkost@redhat.com>2018-12-11 15:45:22 -0200
commitd56978f41b357cc84f2d3fe7d5fef2ae9cddfa61 (patch)
tree85a9582fa4d4c55cadbe4478ed527ec44aed0910
parente25701b730f451d887a2901dffa2525644d856c9 (diff)
downloadqemu-d56978f41b357cc84f2d3fe7d5fef2ae9cddfa61.zip
qemu-d56978f41b357cc84f2d3fe7d5fef2ae9cddfa61.tar.gz
qemu-d56978f41b357cc84f2d3fe7d5fef2ae9cddfa61.tar.bz2
range: pass const pointer where possible
If there are no changes, let's use a const pointer. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20181023152306.3123-4-david@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
-rw-r--r--include/qemu/range.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/qemu/range.h b/include/qemu/range.h
index f28f0c1..7e75f4e 100644
--- a/include/qemu/range.h
+++ b/include/qemu/range.h
@@ -39,7 +39,7 @@ struct Range {
uint64_t upb; /* inclusive upper bound */
};
-static inline void range_invariant(Range *range)
+static inline void range_invariant(const Range *range)
{
assert(range->lob <= range->upb || range->lob == range->upb + 1);
}
@@ -48,14 +48,14 @@ static inline void range_invariant(Range *range)
#define range_empty ((Range){ .lob = 1, .upb = 0 })
/* Is @range empty? */
-static inline bool range_is_empty(Range *range)
+static inline bool range_is_empty(const Range *range)
{
range_invariant(range);
return range->lob > range->upb;
}
/* Does @range contain @val? */
-static inline bool range_contains(Range *range, uint64_t val)
+static inline bool range_contains(const Range *range, uint64_t val)
{
return val >= range->lob && val <= range->upb;
}