aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/xdisp.c35
2 files changed, 19 insertions, 26 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index af944c32ebd..f2604606982 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12010-12-11 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (string_pos_nchars_ahead, c_string_pos)
4 (face_before_or_after_it_pos, next_element_from_string)
5 (next_element_from_c_string, produce_stretch_glyph): Remove unused
6 calculations of maximum string length before calling
7 string_char_and_length and STRING_CHAR_AND_LENGTH.
8 (string_char_and_length): Update commentary: MAXLEN is no longer
9 needed.
10
12010-12-10 Jan Djärv <jan.h.d@swipnet.se> 112010-12-10 Jan Djärv <jan.h.d@swipnet.se>
2 12
3 * keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT 13 * keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT
diff --git a/src/xdisp.c b/src/xdisp.c
index 161e2b1cc4d..d3afac26a68 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1454,11 +1454,10 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos)
1454} 1454}
1455 1455
1456 1456
1457/* Return the next character from STR which is MAXLEN bytes long. 1457/* Return the next character from STR. Return in *LEN the length of
1458 Return in *LEN the length of the character. This is like 1458 the character. This is like STRING_CHAR_AND_LENGTH but never
1459 STRING_CHAR_AND_LENGTH but never returns an invalid character. If 1459 returns an invalid character. If we find one, we return a `?', but
1460 we find one, we return a `?', but with the length of the invalid 1460 with the length of the invalid character. */
1461 character. */
1462 1461
1463static INLINE int 1462static INLINE int
1464string_char_and_length (str, len) 1463string_char_and_length (str, len)
@@ -1492,15 +1491,13 @@ string_pos_nchars_ahead (pos, string, nchars)
1492 1491
1493 if (STRING_MULTIBYTE (string)) 1492 if (STRING_MULTIBYTE (string))
1494 { 1493 {
1495 int rest = SBYTES (string) - BYTEPOS (pos);
1496 const unsigned char *p = SDATA (string) + BYTEPOS (pos); 1494 const unsigned char *p = SDATA (string) + BYTEPOS (pos);
1497 int len; 1495 int len;
1498 1496
1499 while (nchars--) 1497 while (nchars--)
1500 { 1498 {
1501 string_char_and_length (p, &len); 1499 string_char_and_length (p, &len);
1502 p += len, rest -= len; 1500 p += len;
1503 xassert (rest >= 0);
1504 CHARPOS (pos) += 1; 1501 CHARPOS (pos) += 1;
1505 BYTEPOS (pos) += len; 1502 BYTEPOS (pos) += len;
1506 } 1503 }
@@ -1545,14 +1542,13 @@ c_string_pos (charpos, s, multibyte_p)
1545 1542
1546 if (multibyte_p) 1543 if (multibyte_p)
1547 { 1544 {
1548 int rest = strlen (s), len; 1545 int len;
1549 1546
1550 SET_TEXT_POS (pos, 0, 0); 1547 SET_TEXT_POS (pos, 0, 0);
1551 while (charpos--) 1548 while (charpos--)
1552 { 1549 {
1553 string_char_and_length (s, &len); 1550 string_char_and_length (s, &len);
1554 s += len, rest -= len; 1551 s += len;
1555 xassert (rest >= 0);
1556 CHARPOS (pos) += 1; 1552 CHARPOS (pos) += 1;
1557 BYTEPOS (pos) += len; 1553 BYTEPOS (pos) += len;
1558 } 1554 }
@@ -3614,7 +3610,6 @@ face_before_or_after_it_pos (it, before_p)
3614 if (STRING_MULTIBYTE (it->string)) 3610 if (STRING_MULTIBYTE (it->string))
3615 { 3611 {
3616 const unsigned char *p = SDATA (it->string) + BYTEPOS (pos); 3612 const unsigned char *p = SDATA (it->string) + BYTEPOS (pos);
3617 int rest = SBYTES (it->string) - BYTEPOS (pos);
3618 int c, len; 3613 int c, len;
3619 struct face *face = FACE_FROM_ID (it->f, face_id); 3614 struct face *face = FACE_FROM_ID (it->f, face_id);
3620 3615
@@ -6264,7 +6259,6 @@ next_element_from_string (it)
6264 } 6259 }
6265 else if (STRING_MULTIBYTE (it->string)) 6260 else if (STRING_MULTIBYTE (it->string))
6266 { 6261 {
6267 int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
6268 const unsigned char *s = (SDATA (it->string) 6262 const unsigned char *s = (SDATA (it->string)
6269 + IT_STRING_BYTEPOS (*it)); 6263 + IT_STRING_BYTEPOS (*it));
6270 it->c = string_char_and_length (s, &it->len); 6264 it->c = string_char_and_length (s, &it->len);
@@ -6300,7 +6294,6 @@ next_element_from_string (it)
6300 } 6294 }
6301 else if (STRING_MULTIBYTE (it->string)) 6295 else if (STRING_MULTIBYTE (it->string))
6302 { 6296 {
6303 int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
6304 const unsigned char *s = (SDATA (it->string) 6297 const unsigned char *s = (SDATA (it->string)
6305 + IT_STRING_BYTEPOS (*it)); 6298 + IT_STRING_BYTEPOS (*it));
6306 it->c = string_char_and_length (s, &it->len); 6299 it->c = string_char_and_length (s, &it->len);
@@ -6354,13 +6347,7 @@ next_element_from_c_string (it)
6354 BYTEPOS (it->position) = CHARPOS (it->position) = -1; 6347 BYTEPOS (it->position) = CHARPOS (it->position) = -1;
6355 } 6348 }
6356 else if (it->multibyte_p) 6349 else if (it->multibyte_p)
6357 { 6350 it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len);
6358 /* Implementation note: The calls to strlen apparently aren't a
6359 performance problem because there is no noticeable performance
6360 difference between Emacs running in unibyte or multibyte mode. */
6361 int maxlen = strlen (it->s) - IT_BYTEPOS (*it);
6362 it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len);
6363 }
6364 else 6351 else
6365 it->c = it->s[IT_BYTEPOS (*it)], it->len = 1; 6352 it->c = it->s[IT_BYTEPOS (*it)], it->len = 1;
6366 6353
@@ -20917,11 +20904,7 @@ produce_stretch_glyph (it)
20917 20904
20918 it2 = *it; 20905 it2 = *it;
20919 if (it->multibyte_p) 20906 if (it->multibyte_p)
20920 { 20907 it2.c = it2.char_to_display = STRING_CHAR_AND_LENGTH (p, it2.len);
20921 int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT)
20922 - IT_BYTEPOS (*it));
20923 it2.c = it2.char_to_display = STRING_CHAR_AND_LENGTH (p, it2.len);
20924 }
20925 else 20908 else
20926 { 20909 {
20927 it2.c = it2.char_to_display = *p, it2.len = 1; 20910 it2.c = it2.char_to_display = *p, it2.len = 1;