bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WIP patch to reduce rewrite_filename duplication


From: Bruno Haible
Subject: Re: WIP patch to reduce rewrite_filename duplication
Date: Fri, 26 Apr 2024 02:14:16 +0200

Hi Collin,

> > Yep, that's the right way to do it. Maybe file_name should come first
> > (by the usual heuristic that the argument that shows most variation
> > comes first)?
> 
> Sure, that is fine with me. I think the other way is based on how I
> like to write C. Usually I like to place structures (or pointers to
> them) first. The best example I can think of off the top of my head
> is:
> 
>     int fprintf (FILE *stream, const char *format, ...);
> 
> vs.
> 
>    int fputs (const char *str, FILE *stream);
> 
> I always feel awkward using 'fputs' because of that.

Yes, the other heuristic is that when many functions operate on the
same object, like methods in class do, the pointer to that object
is often passed first. And, as you noticed, the two heuristics collide...

Here, I would not think of 'rewrite_file_name' as a method pertaining
to the class GLConfig. Rather, GLConfig is just one of the parameters.

> How does this patch look?

Perfect. OK to push.

> I ran all tests with Python 3.7 and they pass. I don't think
> gnulib-tool --copy-file is tested there though.

Correct. Feel free to add tests for --copy-file, if you like.
I didn't spend time on it, since --copy-file is simple enough.

> I tried to use gettext
> since I remember autogen.sh does it a few times but I see the
> following failure:
> 
> $ cd gettext
> $ env GNULIB_TOOL_IMPL=sh+py sh -x ./autogen.sh
> [...]
> Copying file gnulib-lib/exitfail.c
> 1 out of 1 hunk FAILED -- saving rejects to file /tmp/glDMpS4d/exitfail.h.rej
> /home/collin/.local/src/gnulib/gnulib-tool.sh: *** patch file 
> gnulib-local/lib/exitfail.h.diff didn't apply cleanly
> /home/collin/.local/src/gnulib/gnulib-tool.sh: *** Stop.
> + exit 1

Ah, that's because exitfail.h was modified in Gnulib a few days ago.
Will adapt the override in gettext. Thanks for the notice.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]