2008-02-12 Stefan Monnier <monnier@iro.umontreal.ca>
+ * character.h (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.
+
* casefiddle.c (casify_region): Only call after-change and composition
functions on the part of the region that was changed.
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)
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); \
} \
else \
{ \
- OUTPUT = XSTRING (STRING)->data[BYTEIDX++]; \
+ OUTPUT = SREF (STRING, BYTEIDX); \
+ BYTEIDX++; \
MAKE_CHAR_MULTIBYTE (OUTPUT); \
} \
} \
#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); \
\
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--; \
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--; \