| 335 | more recently than OBJ. If OBJ is zero, free everything in H. */ |
| 336 | |
| 337 | # undef obstack_free |
| 338 | |
| 339 | void |
| 340 | obstack_free (struct obstack *h, void *obj) |
| 341 | { |
| 342 | register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ |
| 343 | register struct _obstack_chunk *plp; /* point to previous chunk if any */ |
| 344 | |
| 345 | lp = h->chunk; |
| 346 | /* We use >= because there cannot be an object at the beginning of a chunk. |
| 347 | But there can be an empty object at that address |
| 348 | at the end of another chunk. */ |
| 349 | while (lp != NULL && ((void *) lp >= obj || (void *) (lp)->limit < obj)) |
| 350 | { |
| 351 | plp = lp->prev; |
| 352 | CALL_FREEFUN (h, lp); |
| 353 | lp = plp; |
| 354 | /* If we switch chunks, we can't tell whether the new current |
| 355 | chunk contains an empty object, so assume that it may. */ |
| 356 | h->maybe_empty_object = 1; |
| 357 | } |
| 358 | if (lp) |
| 359 | { |
| 360 | h->object_base = h->next_free = (char *) (obj); |
| 361 | h->chunk_limit = lp->limit; |
| 362 | h->chunk = lp; |
| 363 | } |
| 364 | else if (obj != NULL) |
| 365 | /* obj is not in any of the chunks! */ |
| 366 | abort (); |
| 367 | } |
| 368 | |