summaryrefslogtreecommitdiff
path: root/src/character.h
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-02-12 21:27:54 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-02-12 21:27:54 +0000
commitf1c996283840d0a9fd60c90f1a9e2aa2a82251a4 (patch)
tree9668a3b56c3aaad51246a20f4cef97c18f9692f6 /src/character.h
parentfff23de29ab4c5c21dacc6927e0f0a4900c6fd59 (diff)
downloademacs-f1c996283840d0a9fd60c90f1a9e2aa2a82251a4.tar.gz
(FETCH_STRING_CHAR_ADVANCE, FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
(FETCH_STRING_CHAR_ADVANCE_NO_CHECK): Use SDATA and SREF. (DEC_POS, BUF_DEC_POS): Use BEG_BYTE rather than hardcoding 1.
Diffstat (limited to 'src/character.h')
-rw-r--r--src/character.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/character.h b/src/character.h
index 60bd1f43f77..41cc8d7211e 100644
--- a/src/character.h
+++ b/src/character.h
@@ -385,14 +385,17 @@ extern char unibyte_has_multibyte_table[256];
CHARIDX++; \
if (STRING_MULTIBYTE (STRING)) \
{ \
- unsigned char *ptr = &XSTRING (STRING)->data[BYTEIDX]; \
+ unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \
int len; \
\
OUTPUT = STRING_CHAR_AND_LENGTH (ptr, 0, len); \
BYTEIDX += len; \
} \
else \
- OUTPUT = XSTRING (STRING)->data[BYTEIDX++]; \
+ { \
+ OUTPUT = SREF (STRING, BYTEIDX); \
+ BYTEIDX++; \
+ } \
} \
while (0)
@@ -405,7 +408,7 @@ extern char unibyte_has_multibyte_table[256];
CHARIDX++; \
if (STRING_MULTIBYTE (STRING)) \
{ \
- unsigned char *ptr = &XSTRING (STRING)->data[BYTEIDX]; \
+ unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \
int len; \
\
OUTPUT = STRING_CHAR_AND_LENGTH (ptr, 0, len); \
@@ -413,7 +416,8 @@ extern char unibyte_has_multibyte_table[256];
} \
else \
{ \
- OUTPUT = XSTRING (STRING)->data[BYTEIDX++]; \
+ OUTPUT = SREF (STRING, BYTEIDX); \
+ BYTEIDX++; \
MAKE_CHAR_MULTIBYTE (OUTPUT); \
} \
} \
@@ -425,7 +429,7 @@ extern char unibyte_has_multibyte_table[256];
#define FETCH_STRING_CHAR_ADVANCE_NO_CHECK(OUTPUT, STRING, CHARIDX, BYTEIDX) \
do \
{ \
- unsigned char *ptr = &XSTRING (STRING)->data[BYTEIDX]; \
+ unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \
int len; \
\
OUTPUT = STRING_CHAR_AND_LENGTH (ptr, 0, len); \
@@ -493,9 +497,9 @@ extern char unibyte_has_multibyte_table[256];
\
pos_byte--; \
if (pos_byte < GPT_BYTE) \
- p = BEG_ADDR + pos_byte - 1; \
+ p = BEG_ADDR + pos_byte - BEG_BYTE; \
else \
- p = BEG_ADDR + GAP_SIZE + pos_byte - 1; \
+ p = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE;\
while (!CHAR_HEAD_P (*p)) \
{ \
p--; \
@@ -551,9 +555,9 @@ extern char unibyte_has_multibyte_table[256];
unsigned char *p; \
pos_byte--; \
if (pos_byte < BUF_GPT_BYTE (buf)) \
- p = BUF_BEG_ADDR (buf) + pos_byte - 1; \
+ p = BUF_BEG_ADDR (buf) + pos_byte - BEG_BYTE; \
else \
- p = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - 1; \
+ p = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - BEG_BYTE;\
while (!CHAR_HEAD_P (*p)) \
{ \
p--; \