emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/alloc.c


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/src/alloc.c
Date: Sat, 11 Jan 2003 19:40:10 -0500

Index: emacs/src/alloc.c
diff -c emacs/src/alloc.c:1.285 emacs/src/alloc.c:1.286
*** emacs/src/alloc.c:1.285     Fri Jan 10 15:08:32 2003
--- emacs/src/alloc.c   Sat Jan 11 19:40:09 2003
***************
*** 3833,3871 ****
  {
    size_t nbytes;
    POINTER_TYPE *result;
!   char *beg = purebeg;
  
    /* Give Lisp_Floats an extra alignment.  */
    if (type == Lisp_Float)
      {
        size_t alignment;
  #if defined __GNUC__ && __GNUC__ >= 2
        alignment = __alignof (struct Lisp_Float);
  #else
        alignment = sizeof (struct Lisp_Float);
  #endif
!       /* Make sure beg + pure_bytes_used is correctly aligned for a
         Lisp_Float, which might need stricter alignment than
         EMACS_INT.  */
!       pure_bytes_used
!       = (ALIGN ((EMACS_UINT) (beg + pure_bytes_used), alignment)
!          - (EMACS_UINT) beg);
      }
      
-   nbytes = ALIGN (size, sizeof (EMACS_INT));
-   
    if (pure_bytes_used + nbytes > pure_size)
      {
        /* Don't allocate a large amount here,
         because it might get mmap'd and then its address
         might not be usable.  */
!       beg = purebeg = (char *) xmalloc (10000);
        pure_size = 10000;
        pure_bytes_used_before_overflow += pure_bytes_used;
        pure_bytes_used = 0;
      }
  
-   result = (POINTER_TYPE *) (beg + pure_bytes_used);
    pure_bytes_used += nbytes;
    return result;
  }
--- 3833,3874 ----
  {
    size_t nbytes;
    POINTER_TYPE *result;
!   char *beg;
! 
!  again:
!   beg = purebeg;
!   result = (POINTER_TYPE *) (beg + pure_bytes_used);
!   nbytes = ALIGN (size, sizeof (EMACS_INT));
  
    /* Give Lisp_Floats an extra alignment.  */
    if (type == Lisp_Float)
      {
+       POINTER_TYPE *orig = result;
        size_t alignment;
  #if defined __GNUC__ && __GNUC__ >= 2
        alignment = __alignof (struct Lisp_Float);
  #else
        alignment = sizeof (struct Lisp_Float);
  #endif
!       /* Make sure result is correctly aligned for a
         Lisp_Float, which might need stricter alignment than
         EMACS_INT.  */
!       result = (POINTER_TYPE *)ALIGN((EMACS_UINT)result, alignment);
!       nbytes += (char *)result - (char *)orig;
      }
      
    if (pure_bytes_used + nbytes > pure_size)
      {
        /* Don't allocate a large amount here,
         because it might get mmap'd and then its address
         might not be usable.  */
!       purebeg = (char *) xmalloc (10000);
        pure_size = 10000;
        pure_bytes_used_before_overflow += pure_bytes_used;
        pure_bytes_used = 0;
+       goto again;
      }
  
    pure_bytes_used += nbytes;
    return result;
  }




reply via email to

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