src/stdlib/SDL_malloc.c
changeset 2196 2aee80dab68a
parent 2194 55e987d8e1b5
child 2203 fca1cdc673b2
equal deleted inserted replaced
2195:46e373b27d6d 2196:2aee80dab68a
   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
   613 #define malloc	SDL_malloc
   614 #define malloc	SDL_malloc
   614 #define calloc	SDL_calloc
   615 #define calloc	SDL_calloc
   615 #define realloc	SDL_realloc
   616 #define realloc	SDL_realloc
   616 #define free	SDL_free
   617 #define free	SDL_free
   617 
   618 
  3910             return chunk2mem(newp);
  3911             return chunk2mem(newp);
  3911         } else {
  3912         } else {
  3912             void *newmem = internal_malloc(m, bytes);
  3913             void *newmem = internal_malloc(m, bytes);
  3913             if (newmem != 0) {
  3914             if (newmem != 0) {
  3914                 size_t oc = oldsize - overhead_for(oldp);
  3915                 size_t oc = oldsize - overhead_for(oldp);
  3915                 SDL_memcpy(newmem, oldmem, (oc < bytes) ? oc : bytes);
  3916                 memcpy(newmem, oldmem, (oc < bytes) ? oc : bytes);
  3916                 internal_free(m, oldmem);
  3917                 internal_free(m, oldmem);
  3917             }
  3918             }
  3918             return newmem;
  3919             return newmem;
  3919         }
  3920         }
  3920     }
  3921     }