Eric Blake wrote:
> + do
> + {
> + tmp = buf;
> + if (first)
> + {
> + size = size ? size : 4096;
> + first = false;
> + }
> + else
> + {
> + size <<= 1;
> + }
> + if ((buf = realloc (tmp, size)) == NULL)
A further hint for optimization:
In the case buf == NULL && size == 0, and when _usually_ the pathname is
small (that's the most frequent case), you are doing a malloc() of 4 KB
followed by a realloc() for shrinking. It would be more efficient to use
a stack-allocated temporary buffer, like
char stack_buf[1024];
in lib/careadlinkat.c.
Bruno
--
In memoriam Heinrich Conradi <http://de.wikipedia.org/wiki/Heinrich_Conradi>