emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r100365: Fix bug #6210.


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100365: Fix bug #6210.
Date: Wed, 19 May 2010 10:22:41 +0300
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100365
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Wed 2010-05-19 10:22:41 +0300
message:
  Fix bug #6210.
  
   bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): Fix
   reallocation of the cache.
modified:
  src/ChangeLog
  src/bidi.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-05-19 02:51:51 +0000
+++ b/src/ChangeLog     2010-05-19 07:22:41 +0000
@@ -1,3 +1,8 @@
+2010-05-19  Eli Zaretskii  <address@hidden>
+
+       * bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): Fix
+       reallocation of the cache.  (Bug#6210)
+
 2010-05-19  Glenn Morris  <address@hidden>
 
        * s/msdos.h (ORDINARY_LINK): Move to sed2v2.inp.

=== modified file 'src/bidi.c'
--- a/src/bidi.c        2010-05-15 14:43:55 +0000
+++ b/src/bidi.c        2010-05-19 07:22:41 +0000
@@ -543,6 +543,7 @@
 #define BIDI_CACHE_CHUNK 200
 static struct bidi_it *bidi_cache;
 static size_t bidi_cache_size = 0;
+static size_t elsz = sizeof (struct bidi_it);
 static int bidi_cache_idx;     /* next unused cache slot */
 static int bidi_cache_last_idx;        /* slot of last cache hit */
 
@@ -558,8 +559,9 @@
 {
   if (bidi_cache_size > BIDI_CACHE_CHUNK)
     {
-      bidi_cache_size = BIDI_CACHE_CHUNK * sizeof (struct bidi_it);
-      bidi_cache = (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size);
+      bidi_cache_size = BIDI_CACHE_CHUNK;
+      bidi_cache =
+       (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size * elsz);
     }
   bidi_cache_reset ();
 }
@@ -688,9 +690,9 @@
       /* Enlarge the cache as needed.  */
       if (idx >= bidi_cache_size)
        {
-         bidi_cache_size += BIDI_CACHE_CHUNK * sizeof (struct bidi_it);
+         bidi_cache_size += BIDI_CACHE_CHUNK;
          bidi_cache =
-           (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size);
+           (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size * elsz);
        }
       /* Character positions should correspond to cache positions 1:1.
         If we are outside the range of cached positions, the cache is


reply via email to

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