emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110314: * bidi.c: Tune.


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110314: * bidi.c: Tune.
Date: Sun, 30 Sep 2012 23:19:52 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110314
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2012-09-30 23:19:52 -0700
message:
  * 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.
modified:
  src/ChangeLog
  src/bidi.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-10-01 02:07:14 +0000
+++ b/src/ChangeLog     2012-10-01 06:19:52 +0000
@@ -1,5 +1,9 @@
 2012-10-01  Paul Eggert  <address@hidden>
 
+       * 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.
+
        Revert the FOLLOW-SYMLINKS change for file-attributes.
        Doing it right would require several changes to Tramp, and there's
        not enough time to get that tested before the freeze today.

=== modified file 'src/bidi.c'
--- a/src/bidi.c        2012-09-15 07:06:56 +0000
+++ b/src/bidi.c        2012-10-01 06:19:52 +0000
@@ -298,15 +298,11 @@
 static inline void
 bidi_copy_it (struct bidi_it *to, struct bidi_it *from)
 {
-  int i;
-
-  /* Copy everything except the level stack and beyond.  */
-  memcpy (to, from, offsetof (struct bidi_it, level_stack[0]));
-
-  /* Copy the active part of the level stack.  */
-  to->level_stack[0] = from->level_stack[0]; /* level zero is always in use */
-  for (i = 1; i <= from->stack_idx; i++)
-    to->level_stack[i] = from->level_stack[i];
+  /* Copy everything from the start through the active part of
+     the level stack.  */
+  memcpy (to, from,
+         (offsetof (struct bidi_it, level_stack[1])
+          + from->stack_idx * sizeof from->level_stack[0]));
 }
 
 
@@ -896,7 +892,7 @@
   return p - start;
 }
 
-/* Fetch and returns the character at byte position BYTEPOS.  If S is
+/* Fetch and return the character at byte position BYTEPOS.  If S is
    non-NULL, fetch the character from string S; otherwise fetch the
    character from the current buffer.  UNIBYTE means S is a
    unibyte string.  */
@@ -905,13 +901,13 @@
 {
   if (s)
     {
+      s += bytepos;
       if (unibyte)
-       return s[bytepos];
-      else
-       return STRING_CHAR (s + bytepos);
+       return *s;
     }
   else
-    return FETCH_MULTIBYTE_CHAR (bytepos);
+    s = BYTE_POS_ADDR (bytepos);
+  return STRING_CHAR (s);
 }
 
 /* Fetch and return the character at BYTEPOS/CHARPOS.  If that


reply via email to

[Prev in Thread] Current Thread [Next in Thread]