bug-gnulib
[Top][All Lists]
Advanced

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

Re: fnmatch memory allocation fix


From: Paul Eggert
Subject: Re: fnmatch memory allocation fix
Date: Tue, 22 Aug 2006 00:13:28 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Are there no comments regarding
> http://lists.gnu.org/archive/html/bug-gnulib/2006-07/msg00333.html ?
> This is code that should fix a problem also in glibc.

I haven't had time to review it well but the basic idea seems fine.

While we're on the subject in my own code I've been more and more
leaning against the use of alloca, and simply using a local array of
size 8000 bytes, falling back on malloc if we need more memory.  If
code isn't recursive, I suspect this is just as good as alloca on
modern architectures, and maybe even a bit faster on some like the
POWER architecture; it's certainly less of a hassle to port.  (I admit
I haven't measured the performance, though.)

But I guess fnmatch is recursive, no?  So perhaps using alloca is
still justifiable there, to save memory.

(Can you tell that I haven't read the fnmatch code lately?  :-)




reply via email to

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