Re: [dev] [st PATCH 1/3] xloadcols: remove cp variable
On Tue, Apr 21, 2015 at 07:54:27AM +0200, Roberto E. Vargas Caballero wrote:
>
> Hi,
>
> > - Color *cp;
> >
> > if(loaded) {
> > - for (cp = dc.col; cp < dc.col + LEN(dc.col); ++cp)
> > - XftColorFree(xw.dpy, xw.vis, xw.cmap, cp);
> > + for (i = 0; i < LEN(dc.col); i++)
> > + XftColorFree(xw.dpy, xw.vis, xw.cmap, &dc.col[i]);
> > }
> >
>
> I prefer the pointer version. I don't know why an index version
> is better in this case.
It reuses the 'i' variable and makes loop style consistent across the
function. It was more obvious before applying next two patches.
Pointer version is ugly because of 'dc.col + LEN(dc.col)' calculation.
Received on Tue Apr 21 2015 - 20:35:38 CEST
This archive was generated by hypermail 2.3.0
: Tue Apr 21 2015 - 20:48:04 CEST