Created
February 3, 2010 01:45
-
-
Save methodmissing/293251 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline int | |
is_pointer_to_heap(ptr) | |
void *ptr; | |
{ | |
RVALUE *p = RANY(ptr); | |
struct heaps_slot *heap; | |
if (p < lomem || p > himem || (VALUE)p % sizeof(RVALUE)) return Qfalse; | |
/* check if p looks like a pointer */ | |
heap = heaps+heaps_used; | |
while (--heap >= heaps) | |
if (p >= heap->slot && p < heap->slot + heap->limit) | |
return Qtrue; | |
return Qfalse; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment