… | |
… | |
83 | |
83 | |
84 | #define array_needsize(base,cur,cnt,init) \ |
84 | #define array_needsize(base,cur,cnt,init) \ |
85 | if ((cnt) > cur) \ |
85 | if ((cnt) > cur) \ |
86 | { \ |
86 | { \ |
87 | int newcnt = cur ? cur << 1 : 16; \ |
87 | int newcnt = cur ? cur << 1 : 16; \ |
88 | fprintf (stderr, "resize(" # base ") from %d to %d\n", cur, newcnt);\ |
|
|
89 | base = realloc (base, sizeof (*base) * (newcnt)); \ |
88 | base = realloc (base, sizeof (*base) * (newcnt)); \ |
90 | init (base + cur, newcnt - cur); \ |
89 | init (base + cur, newcnt - cur); \ |
91 | cur = newcnt; \ |
90 | cur = newcnt; \ |
92 | } |
91 | } |
93 | |
92 | |