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

2024-03-06 Thread Reuben Thomas
On Wed, 6 Mar 2024 at 21:45, Bruno Haible wrote: > > There's no need to change this comment, because the primary places to look > for a function's behaviour are: > 1. the documentation and standard documents, > 2. the .h file (in this case: unistd.in.h line 1121). > Fair enough that there

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

2024-03-06 Thread Bruno Haible
Reuben Thomas wrote: > > > > 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. > ... > Would this comment be better if "In GNU," was deleted? The comment implies > that the

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

2024-03-06 Thread Reuben Thomas
On Wed, 6 Mar 2024 at 20:12, Bruno Haible 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

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

2024-03-06 Thread Reuben Thomas
On Wed, 6 Mar 2024 at 20:09, Paul Smith wrote: > On Wed, 2024-03-06 at 19:55 +0100, Reuben Thomas wrote: > > In getcwd.c I find the following comment: > > > > > 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

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

2024-03-06 Thread Bruno Haible
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. > In GNU, if BUF is NULL, an array is

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

2024-03-06 Thread Paul Smith
On Wed, 2024-03-06 at 19:55 +0100, Reuben Thomas wrote: > In getcwd.c I find the following comment: > > > 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

Does gnulib getcwd always allocate if buf is NULL?

2024-03-06 Thread Reuben Thomas
In getcwd.c I find the following comment: 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. I assume this is