diff options
| author | Michal Nazarewicz | 2016-09-06 17:20:23 +0200 |
|---|---|---|
| committer | Michal Nazarewicz | 2016-09-09 03:07:15 +0200 |
| commit | 3ffc5f44b09e2b500584545389efb8db3be04f95 (patch) | |
| tree | b36cbb467a79999ff55261276014db4707ecd850 /src/buffer.h | |
| parent | e951aa145981cfcee48517dbc7faad89b24e4e96 (diff) | |
| download | emacs-3ffc5f44b09e2b500584545389efb8db3be04f95.tar.gz emacs-3ffc5f44b09e2b500584545389efb8db3be04f95.zip | |
STRING_CHAR does not unify characters; update documentation
* src/character.h (STRING_CHAR): Update doc.
* src/buffer.h (FETCH_MULTIBYTE_CHAR): Update doc. While at it, change
the function to use BYTE_POS_ADDR instead of open-coding it.
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/buffer.h b/src/buffer.h index 87b7cee4413..fa4866e8f72 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -1182,23 +1182,12 @@ buffer_has_overlays (void) | |||
| 1182 | 1182 | ||
| 1183 | /* Return character code of multi-byte form at byte position POS. If POS | 1183 | /* Return character code of multi-byte form at byte position POS. If POS |
| 1184 | doesn't point the head of valid multi-byte form, only the byte at | 1184 | doesn't point the head of valid multi-byte form, only the byte at |
| 1185 | POS is returned. No range checking. | 1185 | POS is returned. No range checking. */ |
| 1186 | |||
| 1187 | WARNING: The character returned by this macro could be "unified" | ||
| 1188 | inside STRING_CHAR, if the original character in the buffer belongs | ||
| 1189 | to one of the Private Use Areas (PUAs) of codepoints that Emacs | ||
| 1190 | uses to support non-unified CJK characters. If that happens, | ||
| 1191 | CHAR_BYTES will return a value that is different from the length of | ||
| 1192 | the original multibyte sequence stored in the buffer. Therefore, | ||
| 1193 | do _not_ use FETCH_MULTIBYTE_CHAR if you need to advance through | ||
| 1194 | the buffer to the next character after fetching this one. Instead, | ||
| 1195 | use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ | ||
| 1196 | 1186 | ||
| 1197 | INLINE int | 1187 | INLINE int |
| 1198 | FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) | 1188 | FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) |
| 1199 | { | 1189 | { |
| 1200 | unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) | 1190 | unsigned char *p = BYTE_POS_ADDR (pos); |
| 1201 | + pos + BEG_ADDR - BEG_BYTE); | ||
| 1202 | return STRING_CHAR (p); | 1191 | return STRING_CHAR (p); |
| 1203 | } | 1192 | } |
| 1204 | 1193 | ||