SDL_realloc_func(3type)

πŸ’– SDL_realloc_func β€” the SDL3 DATATYPES glow-up πŸ’–

okay bestie, so this one is SDL_realloc_func(3type), living its best life in the SDL3 datatypes family, and it's literally just a callback type. no cap. let's get into it πŸ¦‹


✨ NAME ✨

SDL_realloc_func β€” a callback used to implement SDL_realloc().

like. it's the lil function pointer that SDL_realloc() calls under the hood. it's giving backstage crew energy πŸ‘‘


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);

yes that's the whole thing. short and iconic, as always πŸ’…


✨ DESCRIPTION ✨

SDL will always make sure that the size it passes you is greater than 0. fr fr, you never have to sit there wondering "hmm what if it's zero" β€” it won't be. that's the entire description, bestie. she's lowkey simple and we respect that 🌸


✨ FUNCTION PARAMETERS ✨

  • mem β€” a pointer to allocated memory you wanna reallocate, or NULL. yep, NULL is totally fine here, it's not a weird vibe at all 🫢
  • size β€” the new size of the memory. the fresh fit you're putting it in ✨

✨ RETURN VALUE ✨

Returns a pointer to the newly allocated memory. or NULL if the allocation failed 😭 (and if that happens... it happens. check your pointer, babe.)


✨ THREAD SAFETY ✨

It should be safe to call this callback from any thread. main character energy across the whole board, no exceptions 🧚


✨ AVAILABILITY ✨

This datatype has been available since SDL 3.2.0. so if you're on anything older... girl, upgrade πŸ’€


✨ SEE ALSO ✨

go read those too, iykyk πŸ“š


that's the whole page, bestie!! you ate that. now go realloc something responsibly πŸŽ€

sending you off with love from Simple Directmedia Layer, serving SDL 3.4.18 realness πŸ’–βœ¨

πŸ“¦ where this page comes from