Re: [hackers] [sent] [PATCH] remove unnecessary NULL checks and add `void` for an empty parameter list

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Tue, 10 Jan 2023 19:03:03 +0100

On Tue, Jan 10, 2023 at 05:39:33PM +0000, Tom Schwindl wrote:
> ---
> I sent (hehe) this a long time ago, it might be of interest now that some
> work is done.
>
> ---
> sent.c | 30 ++++++++++++++----------------
> 1 file changed, 14 insertions(+), 16 deletions(-)
>
> diff --git a/sent.c b/sent.c
> index 9534fcaf97b9..49853ee6c273 100644
> --- a/sent.c
> +++ b/sent.c
> _AT_@ -99,12 +99,12 @@ static void load(FILE *fp);
> static void advance(const Arg *arg);
> static void quit(const Arg *arg);
> static void resize(int width, int height);
> -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);
>
> static void bpress(XEvent *);
> static void cmessage(XEvent *);
> _AT_@ -216,8 +216,7 @@ ffload(Slide *s)
> s->img->bufwidth = ntohl(*(uint32_t *)&hdr[8]);
> s->img->bufheight = ntohl(*(uint32_t *)&hdr[12]);
>
> - if (s->img->buf)
> - free(s->img->buf);
> + free(s->img->buf);
> /* internally the image is stored in 888 format */
> s->img->buf = ecalloc(s->img->bufwidth * s->img->bufheight, strlen("888"));
>
> _AT_@ -496,7 +495,7 @@ resize(int width, int height)
> }
>
> void
> -run()
> +run(void)
> {
> XEvent ev;
>
> _AT_@ -518,7 +517,7 @@ run()
> }
>
> void
> -xdraw()
> +xdraw(void)
> {
> unsigned int height, width, i;
> Image *im = slides[idx].img;
> _AT_@ -546,7 +545,7 @@ xdraw()
> }
>
> void
> -xhints()
> +xhints(void)
> {
> XClassHint class = {.res_name = "sent", .res_class = "presenter"};
> XWMHints wm = {.flags = InputHint, .input = True};
> _AT_@ -564,7 +563,7 @@ xhints()
> }
>
> void
> -xinit()
> +xinit(void)
> {
> XTextProperty prop;
> unsigned int i;
> _AT_@ -608,7 +607,7 @@ xinit()
> }
>
> void
> -xloadfonts()
> +xloadfonts(void)
> {
> int i, j;
> char *fstrs[LEN(fontfallbacks)];
> _AT_@ -627,8 +626,7 @@ xloadfonts()
> }
>
> for (j = 0; j < LEN(fontfallbacks); j++)
> - if (fstrs[j])
> - free(fstrs[j]);
> + free(fstrs[j]);
> }
>
> void
> _AT_@ -677,7 +675,7 @@ configure(XEvent *e)
> }
>
> void
> -usage()
> +usage(void)
> {
> die("usage: %s [file]", argv0);
> }
> --
> 2.39.0
>
>

Hi Tom,

Applied, thanks for the patch.

sent just works, I can apply some small patches for fixes.
The maintainer is not very active at the moment,

-- 
Kind regards,
Hiltjo
Received on Tue Jan 10 2023 - 19:03:03 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 10 2023 - 19:12:33 CET