[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] rangeset: "has" and "is" functions return boolean
Additionally rangeset_is_empty()'s sole parameter can be const. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- a/xen/common/rangeset.c +++ b/xen/common/rangeset.c @@ -248,11 +248,11 @@ int rangeset_remove_range( return rc; } -int rangeset_contains_range( +bool_t rangeset_contains_range( struct rangeset *r, unsigned long s, unsigned long e) { struct range *x; - int contains; + bool_t contains; ASSERT(s <= e); @@ -264,11 +264,11 @@ int rangeset_contains_range( return contains; } -int rangeset_overlaps_range( +bool_t rangeset_overlaps_range( struct rangeset *r, unsigned long s, unsigned long e) { struct range *x; - int overlaps; + bool_t overlaps; ASSERT(s <= e); @@ -310,14 +310,14 @@ int rangeset_remove_singleton( return rangeset_remove_range(r, s, s); } -int rangeset_contains_singleton( +bool_t rangeset_contains_singleton( struct rangeset *r, unsigned long s) { return rangeset_contains_range(r, s, s); } -int rangeset_is_empty( - struct rangeset *r) +bool_t rangeset_is_empty( + const struct rangeset *r) { return ((r == NULL) || list_empty(&r->range_list)); } --- a/xen/include/xen/rangeset.h +++ b/xen/include/xen/rangeset.h @@ -10,6 +10,8 @@ #ifndef __XEN_RANGESET_H__ #define __XEN_RANGESET_H__ +#include <xen/types.h> + struct domain; struct rangeset; @@ -50,17 +52,17 @@ void rangeset_limit( #define _RANGESETF_prettyprint_hex 0 #define RANGESETF_prettyprint_hex (1U << _RANGESETF_prettyprint_hex) -int __must_check rangeset_is_empty( - struct rangeset *r); +bool_t __must_check rangeset_is_empty( + const struct rangeset *r); /* Add/remove/query a numeric range. */ int __must_check rangeset_add_range( struct rangeset *r, unsigned long s, unsigned long e); int __must_check rangeset_remove_range( struct rangeset *r, unsigned long s, unsigned long e); -int __must_check rangeset_contains_range( +bool_t __must_check rangeset_contains_range( struct rangeset *r, unsigned long s, unsigned long e); -int __must_check rangeset_overlaps_range( +bool_t __must_check rangeset_overlaps_range( struct rangeset *r, unsigned long s, unsigned long e); int rangeset_report_ranges( struct rangeset *r, unsigned long s, unsigned long e, @@ -71,7 +73,7 @@ int __must_check rangeset_add_singleton( struct rangeset *r, unsigned long s); int __must_check rangeset_remove_singleton( struct rangeset *r, unsigned long s); -int __must_check rangeset_contains_singleton( +bool_t __must_check rangeset_contains_singleton( struct rangeset *r, unsigned long s); /* swap contents */ Attachment:
rangeset-contains-bool.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |