src/stdlib/SDL_malloc.c
changeset 2194 55e987d8e1b5
parent 1895 c121d94672cb
child 2196 2aee80dab68a
equal deleted inserted replaced
2193:e857f02e709e 2194:55e987d8e1b5
   608 #ifndef MALLINFO_FIELD_TYPE
   608 #ifndef MALLINFO_FIELD_TYPE
   609 #define MALLINFO_FIELD_TYPE size_t
   609 #define MALLINFO_FIELD_TYPE size_t
   610 #endif /* MALLINFO_FIELD_TYPE */
   610 #endif /* MALLINFO_FIELD_TYPE */
   611 
   611 
   612 #define memset	SDL_memset
   612 #define memset	SDL_memset
   613 #define memcpy	SDL_memcpy
       
   614 #define malloc	SDL_malloc
   613 #define malloc	SDL_malloc
   615 #define calloc	SDL_calloc
   614 #define calloc	SDL_calloc
   616 #define realloc	SDL_realloc
   615 #define realloc	SDL_realloc
   617 #define free	SDL_free
   616 #define free	SDL_free
   618 
   617 
  3911             return chunk2mem(newp);
  3910             return chunk2mem(newp);
  3912         } else {
  3911         } else {
  3913             void *newmem = internal_malloc(m, bytes);
  3912             void *newmem = internal_malloc(m, bytes);
  3914             if (newmem != 0) {
  3913             if (newmem != 0) {
  3915                 size_t oc = oldsize - overhead_for(oldp);
  3914                 size_t oc = oldsize - overhead_for(oldp);
  3916                 memcpy(newmem, oldmem, (oc < bytes) ? oc : bytes);
  3915                 SDL_memcpy(newmem, oldmem, (oc < bytes) ? oc : bytes);
  3917                 internal_free(m, oldmem);
  3916                 internal_free(m, oldmem);
  3918             }
  3917             }
  3919             return newmem;
  3918             return newmem;
  3920         }
  3919         }
  3921     }
  3920     }