[pacman-dev] [PATCH v3 2/3] util-common.h: Add ARRAYSIZE macro
Pierre Neidhardt
ambrevar at gmail.com
Wed Oct 21 08:59:13 UTC 2015
> >> I can see use doing the size of calculation in three places:
> >>
> >> $ git grep sizeof | grep "\["
> >> src/pacman/pacman.c: for(i = 0; i < sizeof(signals) /
> >> sizeof(signals[0]); i++) {
> >> src/pacman/sync.c: for(j = 0; j < sizeof(glob_skips) /
> >> sizeof(glob_skips[0]); j++) {
> >> src/pacman/util.c: static const int unitcount = sizeof(labels) /
> >> sizeof(labels[0]);
> >
> > Wrong regex:
> >
> > $ git grep "sizeof *([^)]*) */"
> > lib/libalpm/pkghash.c: loopsize = sizeof(prime_list) / sizeof(*prime_list);
> > src/pacman/pacman.c: for(i = 0; i < sizeof(signals) / sizeof(signals[0]); i++) {
> > src/pacman/sync.c: for(j = 0; j < sizeof(glob_skips) / sizeof(glob_skips[0]); j++) {
> > src/pacman/util.c: static const int unitcount = sizeof(labels) / sizeof(labels[0]);
> >
> > So yes, alpm has *one* use for it! :D
> >
>
> OK - keep it in util-common then. Will you submit a patch with those
> changed to use ARRAYSIZE? Or should I just patchcount++ myself?
>
> A
I'll do it just now.
--
Pierre Neidhardt
More information about the pacman-dev
mailing list