bug-gnulib
[Top][All Lists]
Advanced

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

Re: Does gnulib getcwd always allocate if buf is NULL?


From: Reuben Thomas
Subject: Re: Does gnulib getcwd always allocate if buf is NULL?
Date: Wed, 6 Mar 2024 20:27:58 +0100

On Wed, 6 Mar 2024 at 20:12, Bruno Haible <bruno@clisp.org> wrote:
Reuben Thomas wrote:
> In getcwd.c I find the following comment:

The Gnulib documentation
https://www.gnu.org/software/gnulib/manual/html_node/getcwd.html
points to the specification. That's usually a more solid reference than
a comment in the code.

Thanks, it seems that the documentation supports my guess.

> In GNU, if BUF is NULL, an array is allocated with 'malloc'; the array is
> > SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary.
> >
>
> However, as far as I can see from the code, it always allocates if BUF is
> NULL.

What is your question?

Would this comment be better if "In GNU," was deleted? The comment implies that the implementation only behaves as specified after the comma on GNU systems, when in fact a particular feature of the gnulib implementation is to bring the GNU behaviour to non-GNU systems.

--
https://rrt.sc3d.org

reply via email to

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