convert BAD_RANGE() to an inline function

William Lee Irwin III (wli@holomorphy.com)
Sun, 2 Jun 2002 15:15:30 -0700


BAD_RANGE() is too complex to merit being a macro definition. The
following patch converts it to an inline function.

Against 2.5.19.

Cheers,
Bill

===== mm/page_alloc.c 1.67 vs edited =====
--- 1.67/mm/page_alloc.c Sun Jun 2 15:10:36 2002
+++ edited/mm/page_alloc.c Sun Jun 2 15:13:24 2002
@@ -46,12 +46,16 @@
/*
* Temporary debugging check.
*/
-#define BAD_RANGE(zone, page) \
-( \
- (((page) - mem_map) >= ((zone)->zone_start_mapnr+(zone)->size)) \
- || (((page) - mem_map) < (zone)->zone_start_mapnr) \
- || ((zone) != page_zone(page)) \
-)
+static inline int BAD_RANGE(zone_t *zone, struct page *page)
+{
+ if (page - mem_map >= zone->zone_start_mapnr + zone->size)
+ return 1;
+ if (page - mem_map < zone->zone_start_mapnr)
+ return 1;
+ if (zone != page_zone(page))
+ return 1;
+ return 0;
+}

/*
* Freeing function for a buddy system allocator.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/