From e91b87a36830d061ef87d67be5f309e4d4ed918f Mon Sep 17 00:00:00 2001 From: "gdb-3.1" Date: Tue, 31 Jan 1989 17:56:40 +0000 Subject: gdb-3.1 --- gdb/obstack.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gdb/obstack.c') diff --git a/gdb/obstack.c b/gdb/obstack.c index 3b5bdef..4379911 100644 --- a/gdb/obstack.c +++ b/gdb/obstack.c @@ -212,6 +212,27 @@ _obstack_newchunk (h, length) h->next_free = h->object_base + obj_size; } +/* Return nonzero if object OBJ has been allocated from obstack H. + This is here for debugging. + If you use it in a program, you are probably losing. */ + +int +_obstack_allocated_p (h, obj) + struct obstack *h; + POINTER obj; +{ + register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */ + register struct _obstack_chunk* plp; /* point to previous chunk if any */ + + lp = (h)->chunk; + while (lp != 0 && ((POINTER)lp > obj || (POINTER)(lp)->limit < obj)) + { + plp = lp -> prev; + lp = plp; + } + return lp != 0; +} + /* Free objects in obstack H, including OBJ and everything allocate more recently than OBJ. If OBJ is zero, free everything in H. */ -- cgit v1.1