Changeset 89124ff for libcfa/src
- Timestamp:
- Oct 25, 2019, 5:34:08 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 9bdb8b7
- Parents:
- eb5a115
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/stdlib.cfa
reb5a115 r89124ff 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Oct 20 18:41:23201913 // Update Count : 47 312 // Last Modified On : Tue Oct 22 08:57:52 2019 13 // Update Count : 478 14 14 // 15 15 … … 21 21 #include <string.h> // memcpy, memset 22 22 #include <malloc.h> // malloc_usable_size 23 #include <math.h> // fabsf, fabs, fabsl23 //#include <math.h> // fabsf, fabs, fabsl 24 24 #include <complex.h> // _Complex_I 25 25 #include <assert.h> … … 41 41 char * nptr; 42 42 size_t alignment = malloc_alignment( ptr ); 43 if ( align != alignment ) {43 if ( align != alignment && (uintptr_t)ptr % align != 0 ) { 44 44 size_t olen = malloc_usable_size( ptr ); // current allocation 45 45 nptr = (char *)memalign( align, olen ); … … 47 47 size_t lnth = olen < nlen ? olen : nlen; // min 48 48 memcpy( nptr, ptr, lnth ); // initialize storage 49 free( ptr ); 49 50 } else { 50 51 nptr = (char *)ptr; … … 62 63 size_t lnth = olen < nlen ? olen : nlen; // min 63 64 memcpy( nptr, ptr, lnth ); // initialize storage 65 free( ptr ); 64 66 } else { 65 67 nptr = (char *)realloc( (void *)ptr, dim * sizeof(T) ); // C realloc
Note: See TracChangeset
for help on using the changeset viewer.