On Fri, Mar 22, 2013 at 08:31:25AM -0400, Christos Zoulas wrote: > Module Name: src > Committed By: christos > Date: Fri Mar 22 12:31:25 UTC 2013 > > Modified Files: > src/external/bsd/mdocml/dist: roff.c > > Log Message: > avoid arraycount for toolz > > > To generate a diff of this commit: > cvs rdiff -u -r1.9 -r1.10 src/external/bsd/mdocml/dist/roff.c > > Please note that diffs are not public domain; they are subject to the > copyright notices on the relevant files. >
> Modified files: > > Index: src/external/bsd/mdocml/dist/roff.c > diff -u src/external/bsd/mdocml/dist/roff.c:1.9 > src/external/bsd/mdocml/dist/roff.c:1.10 > --- src/external/bsd/mdocml/dist/roff.c:1.9 Thu Mar 21 21:24:46 2013 > +++ src/external/bsd/mdocml/dist/roff.c Fri Mar 22 08:31:25 2013 > @@ -1267,7 +1267,7 @@ static struct roff_nr * > hash_find(struct roff *r, const char *str, uint32_t *h) > { > struct roff_nr *e; > - *h = hash_str(str) % __arraycount(r->nr); > + *h = hash_str(str) % (sizeof(r->nr) / sizeof(r->nr[0])); > > for (e = r->nr[*h]; e; e = e->next) > if (e->hash == *h && strcmp(e->str, str) == 0) > I usually find that a #ifndef __arraycount #define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) #endif before the function, and then just use __arraycount(r->nr), is a bit more readable. Best, Alistair