From 20aae107b8e662a1a484eb7b22fe3155a3a92c7b Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Mon, 6 Mar 2006 15:38:59 +0000 Subject: 22321: optimize 22318. --- Src/mem.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Src/mem.c') diff --git a/Src/mem.c b/Src/mem.c index 499f7d7e4..bcdd1efe9 100644 --- a/Src/mem.c +++ b/Src/mem.c @@ -329,6 +329,21 @@ mmap_heap_alloc(size_t *n) } #endif +/* check whether a pointer is within a memory pool */ + +/**/ +mod_export void * +zheapptr(void *p) +{ + Heap h; + queue_signals(); + for (h = heaps; h; h = h->next) + if ((char *)p >= arena(h) && + (char *)p + H_ISIZE < arena(h) + ARENA_SIZEOF(h)) + break; + unqueue_signals(); + return (h ? p : 0); +} /* allocate memory from the current memory pool */ -- cgit v1.2.3