emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107918: Fix minor ralloc.c problems


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107918: Fix minor ralloc.c problems found by static checking.
Date: Sun, 15 Apr 2012 18:18:13 -0700
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107918
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2012-04-15 18:18:13 -0700
message:
  Fix minor ralloc.c problems found by static checking.
  
  See http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html
  * ralloc.c (ALIGNED, ROUND_TO_PAGE, HEAP_PTR_SIZE)
  (r_alloc_size_in_use, r_alloc_freeze, r_alloc_thaw): Remove; unused.
  (r_alloc_sbrk): Now static.
modified:
  src/ChangeLog
  src/ralloc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-04-16 01:10:42 +0000
+++ b/src/ChangeLog     2012-04-16 01:18:13 +0000
@@ -1,5 +1,11 @@
 2012-04-16  Paul Eggert  <address@hidden>
 
+       Fix minor ralloc.c problems found by static checking.
+       See http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html
+       * ralloc.c (ALIGNED, ROUND_TO_PAGE, HEAP_PTR_SIZE)
+       (r_alloc_size_in_use, r_alloc_freeze, r_alloc_thaw): Remove; unused.
+       (r_alloc_sbrk): Now static.
+
        Improve ralloc.c interface checking.
        See http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html
        * buffer.c (ralloc_reset_variable, r_alloc, r_re_alloc)

=== modified file 'src/ralloc.c'
--- a/src/ralloc.c      2012-02-01 16:51:20 +0000
+++ b/src/ralloc.c      2012-04-16 01:18:13 +0000
@@ -95,10 +95,8 @@
 /* Macros for rounding.  Note that rounding to any value is possible
    by changing the definition of PAGE.  */
 #define PAGE (getpagesize ())
-#define ALIGNED(addr) (((unsigned long int) (addr) & (page_size - 1)) == 0)
 #define ROUNDUP(size) (((unsigned long int) (size) + page_size - 1) \
                       & ~(page_size - 1))
-#define ROUND_TO_PAGE(addr) (addr & (~(page_size - 1)))
 
 #define MEM_ALIGN sizeof (double)
 #define MEM_ROUNDUP(addr) (((unsigned long int)(addr) + MEM_ALIGN - 1) \
@@ -151,7 +149,6 @@
 } *heap_ptr;
 
 #define NIL_HEAP ((heap_ptr) 0)
-#define HEAP_PTR_SIZE (sizeof (struct heap))
 
 /* This is the first heap object.
    If we need additional heap objects, each one resides at the beginning of
@@ -366,15 +363,6 @@
        }
     }
 }
-
-/* Return the total size in use by relocating allocator,
-   above where malloc gets space.  */
-
-long
-r_alloc_size_in_use (void)
-{
-  return (char *) break_value - (char *) virtual_break_value;
-}
 
 /* The meat - allocating, freeing, and relocating blocs.  */
 
@@ -748,7 +736,7 @@
    __morecore hook values - in particular, __default_morecore in the
    GNU malloc package.  */
 
-POINTER
+static POINTER
 r_alloc_sbrk (long int size)
 {
   register bloc_ptr b;
@@ -1014,52 +1002,6 @@
   return *ptr;
 }
 
-/* Disable relocations, after making room for at least SIZE bytes
-   of non-relocatable heap if possible.  The relocatable blocs are
-   guaranteed to hold still until thawed, even if this means that
-   malloc must return a null pointer.  */
-
-void
-r_alloc_freeze (long int size)
-{
-  if (! r_alloc_initialized)
-    r_alloc_init ();
-
-  /* If already frozen, we can't make any more room, so don't try.  */
-  if (r_alloc_freeze_level > 0)
-    size = 0;
-  /* If we can't get the amount requested, half is better than nothing.  */
-  while (size > 0 && r_alloc_sbrk (size) == 0)
-    size /= 2;
-  ++r_alloc_freeze_level;
-  if (size > 0)
-    r_alloc_sbrk (-size);
-}
-
-void
-r_alloc_thaw (void)
-{
-
-  if (! r_alloc_initialized)
-    r_alloc_init ();
-
-  if (--r_alloc_freeze_level < 0)
-    abort ();
-
-  /* This frees all unused blocs.  It is not too inefficient, as the resize
-     and memcpy is done only once.  Afterwards, all unreferenced blocs are
-     already shrunk to zero size.  */
-  if (!r_alloc_freeze_level)
-    {
-      bloc_ptr *b = &first_bloc;
-      while (*b)
-       if (!(*b)->variable)
-         free_bloc (*b);
-       else
-         b = &(*b)->next;
-    }
-}
-
 
 #if defined (emacs) && defined (DOUG_LEA_MALLOC)
 


reply via email to

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