Changeset 8ae02b9 in git


Ignore:
Timestamp:
Oct 16, 2007, 10:45:35 AM (17 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
d011a2dfd5880603d857e304e27421ab9d269fed
Parents:
7cb56a987e093ab0f0d2d3ae33f0b891c39bf5fb
Message:
*hannes: memcpy cannot handle overlaps


git-svn-id: file:///usr/local/Singular/svn/trunk@10332 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
omalloc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • omalloc/dlmalloc.c

    r7cb56a9 r8ae02b9  
    44 *  This was obtained by taking cutting out the end of malloc.c
    55 *
    6  *  Version: $Id: dlmalloc.c,v 1.4 2001-04-30 09:01:57 Singular Exp $
     6 *  Version: $Id: dlmalloc.c,v 1.5 2007-10-16 08:45:35 Singular Exp $
    77 *******************************************************************/
    88#ifdef HAVE_CONFIG_H
     
    16751675            newsize += prevsize + nextsize;
    16761676            newmem = chunk2mem(newp);
    1677             MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ);
     1677            MALLOC_MOVE(newmem, oldmem, oldsize - SIZE_SZ);
    16781678            top = chunk_at_offset(newp, nb);
    16791679            set_head(top, (newsize - nb) | PREV_INUSE);
     
    16911691          newsize += nextsize + prevsize;
    16921692          newmem = chunk2mem(newp);
    1693           MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ);
     1693          MALLOC_MOVE(newmem, oldmem, oldsize - SIZE_SZ);
    16941694          goto split;
    16951695        }
     
    17031703        newsize += prevsize;
    17041704        newmem = chunk2mem(newp);
    1705         MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ);
     1705        MALLOC_MOVE(newmem, oldmem, oldsize - SIZE_SZ);
    17061706        goto split;
    17071707      }
  • omalloc/dlmalloc.h

    r7cb56a9 r8ae02b9  
    44 *  This was obtained by taking cutting out the beginning of malloc.c
    55 *
    6  *  Version: $Id: dlmalloc.h,v 1.10 2005-11-08 13:53:37 bricken Exp $
     6 *  Version: $Id: dlmalloc.h,v 1.11 2007-10-16 08:45:35 Singular Exp $
    77 *******************************************************************/
    88#ifndef DL_MALLOC_H
     
    455455} while(0)
    456456
     457#define MALLOC_MOVE(dest,src,nbytes)                                          \
     458do {                                                                          \
     459  INTERNAL_SIZE_T mcsz = (nbytes);                                            \
     460  if(mcsz <= 9*sizeof(mcsz)) {                                                \
     461    INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) (src);                        \
     462    INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) (dest);                       \
     463    if(mcsz >= 5*sizeof(mcsz)) {     *mcdst++ = *mcsrc++;                     \
     464                                     *mcdst++ = *mcsrc++;                     \
     465      if(mcsz >= 7*sizeof(mcsz)) {   *mcdst++ = *mcsrc++;                     \
     466                                     *mcdst++ = *mcsrc++;                     \
     467        if(mcsz >= 9*sizeof(mcsz)) { *mcdst++ = *mcsrc++;                     \
     468                                     *mcdst++ = *mcsrc++; }}}                 \
     469                                     *mcdst++ = *mcsrc++;                     \
     470                                     *mcdst++ = *mcsrc++;                     \
     471                                     *mcdst   = *mcsrc  ;                     \
     472  } else memmove(dest, src, mcsz);                                            \
     473} while(0)
     474
    457475#else /* !USE_MEMCPY */
    458476
     
    493511  }                                                                           \
    494512} while(0)
     513
     514#define MALLOC_MOVE(dest,src,nbytes) MALLOC_COPY(dest,src,nbytes)
    495515
    496516#endif
     
    849869
    850870#if __STD_C
    851   #ifndef __MACH__ 
     871  #ifndef __MACH__
    852872    extern Void_t*     sbrk(ptrdiff_t);
    853   #else 
     873  #else
    854874    extern void    *sbrk(int);
    855875  #endif
Note: See TracChangeset for help on using the changeset viewer.