Re: [hackers] [sent] [PATCH] treewide: Improve compliance with our coding style

From: Tom Schwindl <schwindl_AT_posteo.de>
Date: Sat, 25 Jun 2022 19:23:32 +0000

On Sat, Jun 25, 2022 at 11:38:20PM +0600, NRK wrote:
> On Sat, Jun 25, 2022 at 05:25:54PM +0000, Tom Schwindl wrote:
> > -static void run();
> > -static void usage();
> > -static void xdraw();
> > -static void xhints();
> > -static void xinit();
> > -static void xloadfonts();
> > +static void run(void);
> > +static void usage(void);
> > +static void xdraw(void);
> > +static void xhints(void);
> > +static void xinit(void);
> > +static void xloadfonts(void);
>
> Functions with unspecified arguments is legacy cruft and obsolete since
> C99. I'd perhaps go one step further and add `-Wstrict-prototypes` and
> `-Wold-style-definition` to the list of default warnings in the
> Makefile.

The Makefile and config.mk need to be reworked. Including those options sounds good.
Some unnecessary extensions are used, too, and `-g` is part of the default flags
which isn't really appropriate.

> > - for (j = 0; j < LEN(fontfallbacks); j++)
> > + for (j = 0; j < LEN(fontfallbacks); j++) {
> > if (fstrs[j])
> > free(fstrs[j]);
> > + }
>
> free on NULL is defined to be no-op. The check could be dropped.

Yes, there are a few occurences of this in the code and removing them should be fine.

However, I think all those changes should be submitted on their own.
I'll be happy to do that tomorrow.

-- 
Best Regards,
Tom Schwindl
Received on Sat Jun 25 2022 - 21:23:32 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 25 2022 - 21:36:29 CEST