all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Lawrence Mitchell <wence@gmx.li>
Cc: bug-gnu-emacs@gnu.org
Subject: bug#6378: all-completions Segfault
Date: Tue, 08 Jun 2010 16:30:52 -0400	[thread overview]
Message-ID: <jwvpr01i805.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <pvhpbpblzdic.fsf@gmx.li> (Lawrence Mitchell's message of "Tue, 08 Jun 2010 17:37:47 +0100")

> Although I don't understand why the code-path for the vector
> version can't be simplified as in the following patch, which also
> fixes the problem AFAICT:

> diff --git a/src/minibuf.c b/src/minibuf.c
> index ad81bfd..c6aae27 100644
> --- a/src/minibuf.c
> +++ b/src/minibuf.c
> @@ -1610,22 +1610,14 @@ with a space are ignored unless STRING itself starts with a space.  */)
>  	}
>        else if (type == 2)
>  	{
> -	  if (!EQ (bucket, zero))
> -	    {
> -	      elt = bucket;
> -	      eltstring = elt;
> -	      if (XSYMBOL (bucket)->next)
> -		XSETSYMBOL (bucket, XSYMBOL (bucket)->next);
> -	      else
> -		XSETFASTINT (bucket, 0);
> -	    }
> -	  else if (++index >= obsize)
> -	    break;
> -	  else
> -	    {
> -	      bucket = XVECTOR (collection)->contents[index];
> -	      continue;
> -	    }
> +          if ( index < obsize )
> +            {
> +              elt = bucket;
> +              eltstring = elt;
> +              bucket = XVECTOR (collection)->contents[++index];
> +            }
> +          else
> +            break;
>  	}
>        else /* if (type == 3) */
>  	{

IIUC this would only loop through all the buckets, without looping
through each bucket's linked list.
Compare (length obarray)
and     (let ((i 0)) (mapatoms (lambda (_) (incf i)) obarray) i)


        Stefan





  reply	other threads:[~2010-06-08 20:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-08 15:46 bug#6378: all-completions Segfault Nathan Weizenbaum
2010-06-08 16:37 ` Lawrence Mitchell
2010-06-08 20:30   ` Stefan Monnier [this message]
2010-06-09  5:13     ` Thierry Volpiatto
2010-06-09  6:13       ` Lennart Borgman
2010-06-09  7:23         ` Thierry Volpiatto
2010-06-09  8:51           ` Lennart Borgman
2010-06-09 10:05             ` Thierry Volpiatto
2010-06-09 11:43               ` Andreas Schwab
2010-06-09 12:01                 ` Thierry Volpiatto
2010-06-09 12:13                   ` Andreas Schwab
2010-06-09  6:18       ` Thierry Volpiatto
2010-06-09  9:09     ` Lawrence Mitchell
2010-06-08 16:41 ` Juanma Barranquero
2010-06-08 16:53   ` Juanma Barranquero
2010-06-08 18:58     ` Lennart Borgman
2010-06-08 19:08       ` Juanma Barranquero
2010-06-08 19:32         ` Lennart Borgman
2010-06-08 19:57           ` Juanma Barranquero

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=jwvpr01i805.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=wence@gmx.li \
    /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.