Hummm... as you are essentially counting off pairs, isn't there a way of
detecting end-of-pairs, i.e. along the line (last points to NULL):
for(pairs = start_of_pairs; *pairs; pairs++)
....
or just:
for(i = 0; i < num_pairs; i++)
balance += (pairs[i].init ? 1 : 0) - (pairs[i].exit ? 1 : 0);
(as added bonus doesn't screw up variable pairs' value), or even (same as
yours above but marginally clearer IMEHO):
for (i = 0; i < num_pairs; i++, pairs++)
.....
-- Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/