quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] Re: ftw removed; emacs mode; translations; ready for 0.43?


From: Andreas Gruenbacher
Subject: [Quilt-dev] Re: ftw removed; emacs mode; translations; ready for 0.43?
Date: Thu, 26 Jan 2006 13:03:42 +0100
User-agent: KMail/1.8.2

On Thursday 26 January 2006 10:48, Jean Delvare wrote:
> * perror(NULL) should be perror(progname) or something. It's always very
> frustrating when error messages don't provide any hint at their source.

Ack.

> * The while loop in foreachdir_rec promises to be quite slow, due to the
> repeated use of realloc and strlen.

I tried to keep it simple. It could be optimized in many ways.

> Given that path never changes, we could store the result of strlen(path)
> in a local variable (or even better, 1 + strlen(path) + 1) and use it
> when needed. This would be a first improvement.
>
> However, I think it would be even better to rely on PATH_MAX + 1 for the
> allocation of p (or 4096 where PATH_MAX is not defined) and only
> allocate it once for a given directory. We can then use snprintf instead
> of sprintf and check the return value to detect errors. On error, we can
> realloc with the needed size, or just fail - I really don't see anyone
> using such long names, and as I understand it PATH_MAX is a system limit
> so it probably wouldn't work anyway.

Yes, a PATH_MAX long string would work as well. Do you want to fix it?

Andreas




reply via email to

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