Jeff King <peff@xxxxxxxx> writes: > Most of these are "shift part of the array". I wonder if it would make > sense to encapsulate that pattern in a helper, like: > > #define SHIFT_ARRAY(a, nr, pos, slots) \ > MOVE_ARRAY(a + pos + slots, a + pos, nr - pos - slots) > ... > SHIFT_ARRAY(it->down, it->subtree_nr, pos, 1); Exactly my thought when I was queuing it, but I was wondering about this more from "can we use the higher level abstraction for reducing errors?" point of view. If we are shifting an array by 3 slots to the right, we should at least have enough slots allocated to hold them (i.e. a->nr - a->alloc must be 3 or more). But after realizing that the level these macros operate at is still a bit too low to do something like that, I quickly lost interest ;-) > I'm not sure if that's more readable because it describes a higher-level > operation, or if it's less because it adds yet another non-standard > helper for the reader to learn. Yeah, conflicting goals. It indeed is easier to see what is going on when reading the code, once the reader gets used to them. Thanks.