[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs & MAXPATHLEN
From: |
Alfred M\. Szmidt |
Subject: |
Re: emacs & MAXPATHLEN |
Date: |
Sat, 30 Jul 2005 13:49:52 +0200 |
--- src/buffer.c.old 2005-07-28 19:14:42.000000000 +0200
+++ src/buffer.c 2005-07-30 03:20:36.000000000 +0200
...
+ {
+ int buf_size = 2;
+ buf = xmalloc (buf_size);
+ for(;;)
+ {
+ if(getcwd (buf, buf_size) == 0)
+ {
+ if(errno == ERANGE)
+ {
+ buf_size *= 2;
+ buf = xrealloc (buf, buf_size);
+ }
+ else
+ fatal ("`getcwd' failed: %s\n", strerror (errno));
+ }
+ else
+ break;
+ }
+
+ }
How about the following instead... It is far cleaner and easier to
understand.
int buf_size = 100;
while (1)
{
buf = (char *) xmalloc (buf_size);
if (getcwd (buf, buf_size) == buf)
break;
if (errno != ERANGE)
{
free (buf);
fatal ("`getcwd' failed: %s\n", strerror (errno));
}
size *= 2;
}
- Re: emacs & MAXPATHLEN, (continued)
- Re: emacs & MAXPATHLEN, Alfred M\. Szmidt, 2005/07/30
- Re: emacs & MAXPATHLEN, Eli Zaretskii, 2005/07/30
- Re: emacs & MAXPATHLEN, Alfred M\. Szmidt, 2005/07/30
- Re: emacs & MAXPATHLEN, Andreas Schwab, 2005/07/30
- Re: emacs & MAXPATHLEN, Eli Zaretskii, 2005/07/30
- Re: emacs & MAXPATHLEN, Jan D., 2005/07/30
- Re: emacs & MAXPATHLEN, Andreas Schwab, 2005/07/30
- Re: emacs & MAXPATHLEN, Richard M. Stallman, 2005/07/31
- Re: emacs & MAXPATHLEN, Richard M. Stallman, 2005/07/30
- Re: emacs & MAXPATHLEN, Giuseppe Scrivano, 2005/07/30
- Re: emacs & MAXPATHLEN,
Alfred M\. Szmidt <=
- Re: emacs & MAXPATHLEN, Jan D., 2005/07/30
- Re: emacs & MAXPATHLEN, Alfred M\. Szmidt, 2005/07/30
- Re: emacs & MAXPATHLEN, Giuseppe Scrivano, 2005/07/30
- Re: emacs & MAXPATHLEN, Andreas Schwab, 2005/07/30
- Re: emacs & MAXPATHLEN, Giuseppe Scrivano, 2005/07/30
- Re: emacs & MAXPATHLEN, Giuseppe Scrivano, 2005/07/30
- Re: emacs & MAXPATHLEN, Richard M. Stallman, 2005/07/30
- Re: emacs & MAXPATHLEN, Giuseppe Scrivano, 2005/07/30
- Re: emacs & MAXPATHLEN, Richard M. Stallman, 2005/07/31
- Re: emacs & MAXPATHLEN, Eli Zaretskii, 2005/07/29