Skip to contentSkip to conversation

convert BAD_RANGE() to an inline function

PATCH William Lee Irwin III 1 participant 1 message Jun 2, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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 =====

mm/page_alloc.c +10 -6
@@ -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.