all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Alfred M\. Szmidt" <ams@gnu.org>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: emacs & MAXPATHLEN
Date: Sat, 30 Jul 2005 13:49:52 +0200	[thread overview]
Message-ID: <1122724192.075506.1144.nullmailer@Update.UU.SE> (raw)
In-Reply-To: <87r7dhxenv.fsf@gmail.com> (message from Giuseppe Scrivano on Sat, 30 Jul 2005 03:31:48 +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;
    }

  parent reply	other threads:[~2005-07-30 11:49 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-28 15:32 emacs & MAXPATHLEN Giuseppe Scrivano
2005-07-29  0:11 ` Richard M. Stallman
2005-07-29  0:22   ` Giuseppe Scrivano
2005-07-29 13:29     ` Alfred M. Szmidt
2005-07-29 13:54     ` Richard M. Stallman
2005-07-29 18:30       ` Giuseppe Scrivano
2005-07-30  1:31       ` Giuseppe Scrivano
2005-07-30 10:56         ` Eli Zaretskii
2005-07-30 11:27           ` Jan D.
2005-07-30 11:53           ` Alfred M. Szmidt
2005-07-30 14:28             ` Eli Zaretskii
2005-07-30 14:46               ` Alfred M. Szmidt
2005-07-30 17:35               ` Andreas Schwab
2005-07-30 18:06                 ` Eli Zaretskii
2005-07-30 18:18                   ` Jan D.
2005-07-30 19:11                   ` Andreas Schwab
2005-08-01  0:46                 ` Richard M. Stallman
2005-08-01  8:58                   ` Andreas Schwab
2005-08-01 16:46                     ` Richard M. Stallman
2005-08-01 18:03                       ` David Kastrup
2005-08-03 13:33                         ` Richard M. Stallman
2005-08-03 14:09                           ` David Kastrup
2005-08-03 23:11                             ` Richard M. Stallman
2005-08-04  6:30                               ` David Kastrup
2005-08-04 10:44                                 ` Sascha Wilde
2005-08-04 11:13                                   ` David Kastrup
2005-08-04 14:25                                     ` Sascha Wilde
2005-08-04 14:38                                       ` David Kastrup
2005-08-04 17:57                                         ` Alfred M. Szmidt
2005-08-04 18:11                                         ` Juanma Barranquero
2005-08-04 18:41                                           ` David Kastrup
2005-08-04 18:46                                             ` Juanma Barranquero
2005-08-04 19:07                                         ` Markus Gritsch
2005-08-01 18:52                       ` Andreas Schwab
2005-08-02 17:44                         ` Richard M. Stallman
2005-07-30 23:44             ` Richard M. Stallman
2005-07-31  0:05               ` Giuseppe Scrivano
2005-07-30 11:49         ` Alfred M. Szmidt [this message]
2005-07-30 12:23           ` Jan D.
2005-07-30 12:50             ` Alfred M. Szmidt
2005-07-30 12:58               ` Giuseppe Scrivano
2005-07-30 13:11               ` Andreas Schwab
2005-07-30 13:38                 ` Giuseppe Scrivano
2005-07-30 12:52           ` Giuseppe Scrivano
2005-07-30 15:17         ` Richard M. Stallman
2005-07-30 17:18           ` Giuseppe Scrivano
2005-08-01  0:46             ` Richard M. Stallman
2005-08-01 13:38               ` Giuseppe Scrivano
2005-07-29 13:54     ` Eli Zaretskii
2005-07-30  3:34       ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1122724192.075506.1144.nullmailer@Update.UU.SE \
    --to=ams@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.