aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-09-30 23:19:52 -0700
committerPaul Eggert2012-09-30 23:19:52 -0700
commit05584c31090df82f831f2998939fd423f036e86d (patch)
tree1f4ab704433ef74b1ede5fe0db70fa48de324bc9 /src
parent8eba2b3583f7ea70e308c6ddebbec57f9c0bea3c (diff)
downloademacs-05584c31090df82f831f2998939fd423f036e86d.tar.gz
emacs-05584c31090df82f831f2998939fd423f036e86d.zip
* bidi.c: Tune.
(bidi_copy_it): Do the whole copy with a single memcpy. (bidi_char_at_pos): Merge the two STRING_CHAR calls into one.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/bidi.c24
2 files changed, 14 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9ad044a570a..b8471445479 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12012-10-01 Paul Eggert <eggert@cs.ucla.edu> 12012-10-01 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * bidi.c: Tune.
4 (bidi_copy_it): Do the whole copy with a single memcpy.
5 (bidi_char_at_pos): Merge the two STRING_CHAR calls into one.
6
3 Revert the FOLLOW-SYMLINKS change for file-attributes. 7 Revert the FOLLOW-SYMLINKS change for file-attributes.
4 Doing it right would require several changes to Tramp, and there's 8 Doing it right would require several changes to Tramp, and there's
5 not enough time to get that tested before the freeze today. 9 not enough time to get that tested before the freeze today.
diff --git a/src/bidi.c b/src/bidi.c
index af0209565e2..deb01c76496 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -298,15 +298,11 @@ bidi_remember_char (struct bidi_saved_info *saved_info,
298static inline void 298static inline void
299bidi_copy_it (struct bidi_it *to, struct bidi_it *from) 299bidi_copy_it (struct bidi_it *to, struct bidi_it *from)
300{ 300{
301 int i; 301 /* Copy everything from the start through the active part of
302 302 the level stack. */
303 /* Copy everything except the level stack and beyond. */ 303 memcpy (to, from,
304 memcpy (to, from, offsetof (struct bidi_it, level_stack[0])); 304 (offsetof (struct bidi_it, level_stack[1])
305 305 + from->stack_idx * sizeof from->level_stack[0]));
306 /* Copy the active part of the level stack. */
307 to->level_stack[0] = from->level_stack[0]; /* level zero is always in use */
308 for (i = 1; i <= from->stack_idx; i++)
309 to->level_stack[i] = from->level_stack[i];
310} 306}
311 307
312 308
@@ -896,7 +892,7 @@ bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg,
896 return p - start; 892 return p - start;
897} 893}
898 894
899/* Fetch and returns the character at byte position BYTEPOS. If S is 895/* Fetch and return the character at byte position BYTEPOS. If S is
900 non-NULL, fetch the character from string S; otherwise fetch the 896 non-NULL, fetch the character from string S; otherwise fetch the
901 character from the current buffer. UNIBYTE means S is a 897 character from the current buffer. UNIBYTE means S is a
902 unibyte string. */ 898 unibyte string. */
@@ -905,13 +901,13 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte)
905{ 901{
906 if (s) 902 if (s)
907 { 903 {
904 s += bytepos;
908 if (unibyte) 905 if (unibyte)
909 return s[bytepos]; 906 return *s;
910 else
911 return STRING_CHAR (s + bytepos);
912 } 907 }
913 else 908 else
914 return FETCH_MULTIBYTE_CHAR (bytepos); 909 s = BYTE_POS_ADDR (bytepos);
910 return STRING_CHAR (s);
915} 911}
916 912
917/* Fetch and return the character at BYTEPOS/CHARPOS. If that 913/* Fetch and return the character at BYTEPOS/CHARPOS. If that