include/SDL_stdinc.h
changeset 11610 6dea196ecbcb
parent 11459 a09ca9e8938c
child 11618 bbbc6db5a2b3
equal deleted inserted replaced
11607:db7ee6a1ba6a 11610:6dea196ecbcb
   344 
   344 
   345 extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
   345 extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
   346 extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
   346 extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
   347 extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
   347 extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
   348 extern DECLSPEC void SDLCALL SDL_free(void *mem);
   348 extern DECLSPEC void SDLCALL SDL_free(void *mem);
       
   349 
       
   350 typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
       
   351 typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
       
   352 typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
       
   353 typedef void (SDLCALL *SDL_free_func)(void *mem);
       
   354 
       
   355 /**
       
   356  *  \brief Get the current set of SDL memory functions
       
   357  */
       
   358 extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
       
   359                                                     SDL_calloc_func *calloc_func,
       
   360                                                     SDL_realloc_func *realloc_func,
       
   361                                                     SDL_free_func *free_func);
       
   362 
       
   363 /**
       
   364  *  \brief Replace SDL's memory allocation functions with a custom set
       
   365  *
       
   366  *  \note If you are replacing SDL's memory functions, you should call
       
   367  *        SDL_GetNumAllocations() and be very careful if it returns non-zero.
       
   368  *        That means that your free function will be called with memory
       
   369  *        allocated by the previous memory allocation functions.
       
   370  */
       
   371 extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
       
   372                                                    SDL_calloc_func calloc_func,
       
   373                                                    SDL_realloc_func realloc_func,
       
   374                                                    SDL_free_func free_func);
       
   375 
       
   376 /**
       
   377  *  \brief Get the number of outstanding (unfreed) allocations
       
   378  */
       
   379 extern DECLSPEC int SDLCALL SDL_GetNumAllocations();
   349 
   380 
   350 extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
   381 extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
   351 extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
   382 extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
   352 
   383 
   353 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
   384 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));