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:23:14 +0100

On Wed, 6 Mar 2024 at 20:09, Paul Smith <psmith@gnu.org> 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 as
> > big as necessary.
>
> However, as far as I can see from the code, it always allocates if
> BUF is NULL.

I don't think your observation contradicts the comment...is there more
to it?

My point is that if BUF is NULL, an array is allocated with 'malloc'. It has nothing to do with being on a GNU or non-GNU system.


reply via email to

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