public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: linux-kernel@vger.kernel.org
Cc: trivial@rustcorp.com.au
Subject: convert BAD_RANGE() to an inline function
Date: Sun, 2 Jun 2002 15:15:30 -0700	[thread overview]
Message-ID: <20020602221530.GM14918@holomorphy.com> (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 =====
--- 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.

                 reply	other threads:[~2002-06-02 22:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020602221530.GM14918@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trivial@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox