Jeff King <peff@xxxxxxxx> writes: > ... But we could do something like > (totally untested): > > #define alloc_grow(x, nr, alloc) \ > alloc_grow_helper(&(x), nr, &(alloc), sizeof(*(x))) > > inline > void alloc_grow_helper(void **x, int nr, int *alloc, int size) > { > if (nr >= *alloc) { > *alloc = alloc_nr(*alloc); > *x = xrealloc(*x, *alloc * size); > } > } > > Horribly ugly (I'm seeing stars!) but probably a bit safer in the long > run, and nobody needs to look at it most of the time. :) > > What do you think? That looks ugly and also I am curious what the generated assembly would look like. Hopefully the compiler is clever enough to generate the same code, but I dunno. Unless somebody else more versed with C preprocessor tricks comes along and offers a better advice, I would go with the earlier simpler one with a big fat warning. I however would prefer all caps name for a magic macro like this, whose sole point is a huge side effect. Anyway, it appears that Jonas picked up your patch to polish up, so I won't touch this series until that resurfaces. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html