MCPcopy Create free account
hub / github.com/git/git / obstack_free

Function obstack_free

compat/obstack.c:337–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335 more recently than OBJ. If OBJ is zero, free everything in H. */
336
337# undef obstack_free
338
339void
340obstack_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

Callers 2

kwsincrFunction · 0.85
kwsfreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected