3 ms·
It's even easier if you use a garbage collector, like for instance libgc. Then you just replace (ptr) = malloc((n) * sizeof (ptr)[0]); with (ptr) = GC_MA
by augustk 4y ago
It's even easier if you use a garbage collector, like for instance libgc. Then you just replace
(ptr) = malloc((n) * sizeof (ptr)[0]);
with
(ptr) = GC_MALLOC((n) * sizeof (ptr)[0]);
in the macro and don't have to worry about calling free.