unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Assertion failure in set_iterator_to_next
Date: Sun, 11 Apr 2010 16:04:05 -0400	[thread overview]
Message-ID: <jwv7hodzrlz.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <831velzwio.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 11 Apr 2010 21:14:55 +0300")

>> > No, it->len should be the length of the multibyte sequence of the
>> > character at IT_CHARPOS (*it).  This is how the basic iteration works,
>> > and if the length is incorrect, we will get garbled display, in
>> > anything but pure 7-bit ASCII buffers.
>> OK, good.  Can you update/complete dispextern.h correspondingly?
> Will do.

Thanks.

>> So the problem now is "why is it->len ==3 rather than ==1"?
> I think it's because it was not yet updated.  It is updated only in
> the next_element_from_* functions.  E.g., for a character from a
> buffer, we have this in next_element_from_buffer:

>       /* Get the next character, maybe multibyte.  */
>       p = BYTE_POS_ADDR (IT_BYTEPOS (*it));
>       if (it->multibyte_p && !ASCII_BYTE_P (*p))
>         it-> c = STRING_CHAR_AND_LENGTH (p, it->len);     <<<<<<<<<
>       else
>         it-> c = *p, it->len = 1;                         <<<<<<<<<

Oh, thank you very much.  I searched for this spot and couldn't find it
(I grepped with a pattern like "->len =", which only caught the second
line which couldn't explain why I was getting it->len==3.
That should help me move forward.

> Since you are saying this is an ASCII buffer, are charpos and bytepos
> at least identical?

Yes, they're identical before the assignment to IT_CHARPOS and
IT_BYTEPOS, but since it->len==3 a discrepancy of 2 appears which then
triggers the subsequent xassert.


        Stefan




  reply	other threads:[~2010-04-11 20:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-11  0:52 Assertion failure in set_iterator_to_next Stefan Monnier
2010-04-11  3:14 ` Eli Zaretskii
2010-04-11 15:02   ` Stefan Monnier
2010-04-11 18:14     ` Eli Zaretskii
2010-04-11 20:04       ` Stefan Monnier [this message]
2010-04-11 21:12         ` Eli Zaretskii
2010-04-19 15:30         ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwv7hodzrlz.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).