From 702efade7a5bb759f1d6df07e20180ba95d87f3d Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Mon, 25 May 2020 14:20:46 +0000 Subject: [PATCH] Fix more single-byte accesses. --- src/cmds.c | 2 +- src/syntax.c | 4 +--- src/xdisp.c | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/cmds.c b/src/cmds.c index 9914b7a01f..2dd68ee067 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -399,7 +399,7 @@ internal_self_insert (int c, EMACS_INT n) by spaces so that the remaining text won't move. */ ptrdiff_t actual = PT_BYTE; DEC_POS (actual); - if (FETCH_CHAR (actual) == '\t') + if (FETCH_BYTE (actual) == '\t') /* Rather than add spaces, let's just keep the tab. */ chars_to_delete--; else diff --git a/src/syntax.c b/src/syntax.c index a79ab86336..ef66f3ddd6 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -733,7 +733,6 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, { rarely_quit (++quit_count); - ptrdiff_t temp_byte; int prev_syntax; bool com2start, com2end, comstart; @@ -884,8 +883,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, if (open_paren_in_column_0_is_defun_start && NILP (Vcomment_use_syntax_ppss) && (from == stop - || (temp_byte = dec_bytepos (from_byte), - FETCH_CHAR (temp_byte) == '\n'))) + || (FETCH_BYTE (from_byte - 1) == '\n'))) { defun_start = from; defun_start_byte = from_byte; diff --git a/src/xdisp.c b/src/xdisp.c index bff6218106..4490878ccd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10474,7 +10474,7 @@ height (excluding the height of the mode- or header-line, if any) that while (bpos > BEGV_BYTE) { DEC_BOTH (start, bpos); - c = FETCH_CHAR (bpos); + c = FETCH_BYTE (bpos); if (!(c == ' ' || c == '\t')) break; } @@ -10497,7 +10497,7 @@ height (excluding the height of the mode- or header-line, if any) that while (bpos > BEGV_BYTE) { DEC_BOTH (end, bpos); - c = FETCH_CHAR (bpos); + c = FETCH_BYTE (bpos); if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) break; } @@ -22119,7 +22119,7 @@ trailing_whitespace_p (ptrdiff_t charpos) int c = 0; while (bytepos < ZV_BYTE - && (c = FETCH_CHAR (bytepos), + && (c = FETCH_BYTE (bytepos), c == ' ' || c == '\t')) ++bytepos; -- 2.27.0.rc0