include/SDL_stdinc.h
changeset 11610 6dea196ecbcb
parent 11459 a09ca9e8938c
child 11618 bbbc6db5a2b3
     1.1 --- a/include/SDL_stdinc.h	Thu Oct 12 13:28:48 2017 -0700
     1.2 +++ b/include/SDL_stdinc.h	Thu Oct 12 13:44:28 2017 -0700
     1.3 @@ -347,6 +347,37 @@
     1.4  extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
     1.5  extern DECLSPEC void SDLCALL SDL_free(void *mem);
     1.6  
     1.7 +typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
     1.8 +typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
     1.9 +typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
    1.10 +typedef void (SDLCALL *SDL_free_func)(void *mem);
    1.11 +
    1.12 +/**
    1.13 + *  \brief Get the current set of SDL memory functions
    1.14 + */
    1.15 +extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
    1.16 +                                                    SDL_calloc_func *calloc_func,
    1.17 +                                                    SDL_realloc_func *realloc_func,
    1.18 +                                                    SDL_free_func *free_func);
    1.19 +
    1.20 +/**
    1.21 + *  \brief Replace SDL's memory allocation functions with a custom set
    1.22 + *
    1.23 + *  \note If you are replacing SDL's memory functions, you should call
    1.24 + *        SDL_GetNumAllocations() and be very careful if it returns non-zero.
    1.25 + *        That means that your free function will be called with memory
    1.26 + *        allocated by the previous memory allocation functions.
    1.27 + */
    1.28 +extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
    1.29 +                                                   SDL_calloc_func calloc_func,
    1.30 +                                                   SDL_realloc_func realloc_func,
    1.31 +                                                   SDL_free_func free_func);
    1.32 +
    1.33 +/**
    1.34 + *  \brief Get the number of outstanding (unfreed) allocations
    1.35 + */
    1.36 +extern DECLSPEC int SDLCALL SDL_GetNumAllocations();
    1.37 +
    1.38  extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
    1.39  extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
    1.40