emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112036: * xdisp.c (init_iterator): S


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112036: * xdisp.c (init_iterator): Simplify because both character and byte
Date: Wed, 13 Mar 2013 19:21:46 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112036
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2013-03-13 19:21:46 +0400
message:
  * xdisp.c (init_iterator): Simplify because both character and byte
  positions are either specified or -1.  Add eassert.  Adjust comment.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-03-13 07:27:34 +0000
+++ b/src/ChangeLog     2013-03-13 15:21:46 +0000
@@ -1,3 +1,8 @@
+2013-03-13  Dmitry Antipov  <address@hidden>
+
+       * xdisp.c (init_iterator): Simplify because both character and byte
+       positions are either specified or -1.  Add eassert.  Adjust comment.
+
 2013-03-13  Paul Eggert  <address@hidden>
 
        Static checking by Sun C 5.12.

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-03-10 17:28:04 +0000
+++ b/src/xdisp.c       2013-03-13 15:21:46 +0000
@@ -2550,7 +2550,7 @@
    at character position CHARPOS.  CHARPOS < 0 means that no buffer
    position is specified which is useful when the iterator is assigned
    a position later.  BYTEPOS is the byte position corresponding to
-   CHARPOS.  BYTEPOS < 0 means compute it from CHARPOS.
+   CHARPOS.
 
    If ROW is not null, calls to produce_glyphs with IT as parameter
    will produce glyphs in that row.
@@ -2828,18 +2828,14 @@
   if (charpos >= BUF_BEG (current_buffer))
     {
       it->end_charpos = ZV;
+      eassert (charpos == BYTE_TO_CHAR (bytepos));
       IT_CHARPOS (*it) = charpos;
+      IT_BYTEPOS (*it) = bytepos;
 
       /* We will rely on `reseat' to set this up properly, via
         handle_face_prop.  */
       it->face_id = it->base_face_id;
 
-      /* Compute byte position if not specified.  */
-      if (bytepos < charpos)
-       IT_BYTEPOS (*it) = CHAR_TO_BYTE (charpos);
-      else
-       IT_BYTEPOS (*it) = bytepos;
-
       it->start = it->current;
       /* Do we need to reorder bidirectional text?  Not if this is a
         unibyte buffer: by definition, none of the single-byte


reply via email to

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