2 * This file is part of libdyn.a, the C Dynamic Object library. It
3 * contains the source code for the internal function _DynRealloc().
5 * There are no restrictions on this code; however, if you make any
6 * changes, I request that you document them so that I do not get
7 * credit or blame for your modifications.
9 * Written by Barr3y Jaspan, Student Information Processing Board (SIPB)
10 * and MIT-Project Athena, 1989.
18 * Ideally, this function should not be called from outside the
19 * library. However, nothing will break if it is.
22 _DynRealloc(DynObject obj,
26 int new_size_in_bytes;
28 new_size_in_bytes = obj->el_size*(obj->size + obj->inc*num_incs);
32 "dyn: alloc: Increasing object by %d bytes (%d incs).\n",
33 obj->el_size*obj->inc*num_incs, num_incs);
35 temp = (DynPtr) realloc(obj->array, new_size_in_bytes);
38 fprintf(stderr, "dyn: alloc: Out of memory.\n");
43 obj->size += obj->inc*num_incs;
47 fprintf(stderr, "dyn: alloc: done.\n");