Mercurial > ecos
changeset 2455:fcbc1384c4e3
* src/dlmalloc.cxx (MALLOC_COPY):
* cdl/memalloc.cdl: Use memmove instead of memcpy which can go
wrong in realloc() when the new and old block overlaps.
CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_USE_MEMCPY has been retained
instead of being renamed to ..._MEMMOVE to help backward
compatibility with older configurations. Thanks to Oyvind Harboe
and Dave Lawrence.
| author | asl |
|---|---|
| date | Sun, 06 Jan 2008 12:17:41 +0000 |
| parents | 1f046a6b2a6c |
| children | 845a99596640 |
| files | packages/services/memalloc/common/current/ChangeLog packages/services/memalloc/common/current/cdl/memalloc.cdl packages/services/memalloc/common/current/src/dlmalloc.cxx |
| diffstat | 3 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/services/memalloc/common/current/ChangeLog +++ b/packages/services/memalloc/common/current/ChangeLog @@ -1,3 +1,13 @@ +2008-01-06 Andrew Lunn <andrew.lunn@ascom.ch> + + * src/dlmalloc.cxx (MALLOC_COPY): + * cdl/memalloc.cdl: Use memmove instead of memcpy which can go + wrong in realloc() when the new and old block overlaps. + CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_USE_MEMCPY has been retained + instead of being renamed to ..._MEMMOVE to help backward + compatibility with older configurations. Thanks to Oyvind Harboe + and Dave Lawrence. + 2007-11-05 Oyvind Harboe <oyvind.harboe@zylin.com> * cdl/memalloc.cdl: Added option CYGBLD_MEMALLOC_MALLOC_EXTERNAL_JOIN_H @@ -10,7 +20,6 @@ 2007-10-24 Jonathan Larmour <jifl@eCos * src/malloc.cxx: Init priority for pool initialization is now CYG_INIT_MEMALLOC instead of before CYG_INIT_LIBC - * src/heapgen.tcl: Ditto. 2006-05-17 Andrew Lunn <andrew.lunn@ascom.ch>
--- a/packages/services/memalloc/common/current/cdl/memalloc.cdl +++ b/packages/services/memalloc/common/current/cdl/memalloc.cdl @@ -176,11 +176,11 @@ cdl_package CYGPKG_MEMALLOC { } cdl_option CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_USE_MEMCPY { - display "Use system memcpy() and memset()" + display "Use system memmove() and memset()" requires CYGPKG_ISOINFRA default_value { 0 != CYGPKG_ISOINFRA } description " - This may be used to control whether memset() and memcpy() + This may be used to control whether memset() and memmove() are used within the implementation. The alternative is to use some macro equivalents, which some people report are faster in some circumstances."
--- a/packages/services/memalloc/common/current/src/dlmalloc.cxx +++ b/packages/services/memalloc/common/current/src/dlmalloc.cxx @@ -295,7 +295,7 @@ #ifdef CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_USE_MEMCPY -#include <string.h> // memcpy, memset +#include <string.h> // memmove, memset /* The following macros are only invoked with (2n+1)-multiples of INTERNAL_SIZE_T units, with a positive integer n. This is exploited @@ -333,7 +333,7 @@ do { *mcdst++ = *mcsrc++; \ *mcdst++ = *mcsrc++; \ *mcdst = *mcsrc ; \ - } else memcpy(dest, src, mcsz); \ + } else memmove(dest, src, mcsz); \ } while(0) #else /* !CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_USE_MEMCPY */
