all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michal Nazarewicz <mina86@mina86.com>
To: 24378@debbugs.gnu.org
Subject: bug#24378: [PATCH] Remove obsolete comment from FETCH_MULTIBYTE_CHAR documentation
Date: Tue,  6 Sep 2016 17:24:38 +0200	[thread overview]
Message-ID: <1473175478-7858-1-git-send-email-mina86@mina86.com> (raw)
In-Reply-To: <83poohay1n.fsf@gnu.org>

* src/buffer.h (FETCH_MULTIBYTE_CHAR): STRING_CHAR macro no longer
unifies characters so the comment about byte-length changing is no
longer accurate; remove it.  While at it, change the function to use
BYTE_POS_ADDR instead of open-coding it.
---
 src/buffer.h | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/buffer.h b/src/buffer.h
index 87b7cee..fa4866e 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1182,23 +1182,12 @@ buffer_has_overlays (void)
 
 /* Return character code of multi-byte form at byte position POS.  If POS
    doesn't point the head of valid multi-byte form, only the byte at
-   POS is returned.  No range checking.
-
-   WARNING: The character returned by this macro could be "unified"
-   inside STRING_CHAR, if the original character in the buffer belongs
-   to one of the Private Use Areas (PUAs) of codepoints that Emacs
-   uses to support non-unified CJK characters.  If that happens,
-   CHAR_BYTES will return a value that is different from the length of
-   the original multibyte sequence stored in the buffer.  Therefore,
-   do _not_ use FETCH_MULTIBYTE_CHAR if you need to advance through
-   the buffer to the next character after fetching this one.  Instead,
-   use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH.  */
+   POS is returned.  No range checking. */
 
 INLINE int
 FETCH_MULTIBYTE_CHAR (ptrdiff_t pos)
 {
-  unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0)
-		      + pos + BEG_ADDR - BEG_BYTE);
+  unsigned char *p = BYTE_POS_ADDR (pos);
   return STRING_CHAR (p);
 }
 
-- 
2.8.0.rc3.226.g39d4020






  parent reply	other threads:[~2016-09-06 15:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06 13:28 bug#24378: [PATCH 0/6] Small fixes and improvements Michal Nazarewicz
2016-09-06 13:31 ` bug#24378: [PATCH 1/6] Don’t use FETCH_MULTIBYTE_CHAR when advancing index Michal Nazarewicz
2016-09-06 13:31   ` bug#24378: [PATCH 2/6] Remove inaccurate comment in regex.c Michal Nazarewicz
2016-09-06 13:31   ` bug#24378: [PATCH 3/6] Replace decimalnump with alphanumericp Michal Nazarewicz
2016-09-06 13:31   ` bug#24378: [PATCH 4/6] Remove dead loop iterations in regex.c Michal Nazarewicz
2016-09-06 13:31   ` bug#24378: [PATCH 5/6] Don’t allocate char-table’s extra slots in regexp-out-charset Michal Nazarewicz
2016-09-06 13:31   ` bug#24378: [PATCH 6/6] Factor out character category lookup to separate function Michal Nazarewicz
2016-09-06 14:54     ` Eli Zaretskii
2016-09-06 15:11       ` Michal Nazarewicz
2016-09-06 15:21         ` Eli Zaretskii
2016-09-06 15:34           ` Eli Zaretskii
2016-09-06 14:43   ` bug#24378: [PATCH 1/6] Don’t use FETCH_MULTIBYTE_CHAR when advancing index Eli Zaretskii
2016-09-06 15:17     ` Michal Nazarewicz
2016-09-06 15:27       ` Eli Zaretskii
2016-09-06 15:24     ` Michal Nazarewicz [this message]
2016-09-09 16:34 ` bug#24378: [PATCH 0/6] Small fixes and improvements Michal Nazarewicz

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=1473175478-7858-1-git-send-email-mina86@mina86.com \
    --to=mina86@mina86.com \
    --cc=24378@debbugs.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.