Added SDL_ClaimEventMemory()
This commit is contained in:
@@ -29,6 +29,7 @@ SDL3_0.0.0 {
|
||||
SDL_BlitSurfaceUncheckedScaled;
|
||||
SDL_BroadcastCondition;
|
||||
SDL_CaptureMouse;
|
||||
SDL_ClaimEventMemory;
|
||||
SDL_CleanupTLS;
|
||||
SDL_ClearAudioStream;
|
||||
SDL_ClearClipboardData;
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#define SDL_BlitSurfaceUncheckedScaled SDL_BlitSurfaceUncheckedScaled_REAL
|
||||
#define SDL_BroadcastCondition SDL_BroadcastCondition_REAL
|
||||
#define SDL_CaptureMouse SDL_CaptureMouse_REAL
|
||||
#define SDL_ClaimEventMemory SDL_ClaimEventMemory_REAL
|
||||
#define SDL_CleanupTLS SDL_CleanupTLS_REAL
|
||||
#define SDL_ClearAudioStream SDL_ClearAudioStream_REAL
|
||||
#define SDL_ClearClipboardData SDL_ClearClipboardData_REAL
|
||||
|
||||
@@ -74,6 +74,7 @@ SDL_DYNAPI_PROC(int,SDL_BlitSurfaceUnchecked,(SDL_Surface *a, const SDL_Rect *b,
|
||||
SDL_DYNAPI_PROC(int,SDL_BlitSurfaceUncheckedScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_BroadcastCondition,(SDL_Condition *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_CaptureMouse,(SDL_bool a),(a),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_ClaimEventMemory,(const void *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_CleanupTLS,(void),(),)
|
||||
SDL_DYNAPI_PROC(int,SDL_ClearAudioStream,(SDL_AudioStream *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ClearClipboardData,(void),(),return)
|
||||
|
||||
@@ -212,6 +212,33 @@ static void SDL_FlushEventMemory(Uint32 eventID)
|
||||
}
|
||||
}
|
||||
|
||||
void *SDL_ClaimEventMemory(const void *mem)
|
||||
{
|
||||
SDL_EventMemoryState *state;
|
||||
|
||||
state = SDL_GetEventMemoryState(SDL_FALSE);
|
||||
if (state && mem) {
|
||||
SDL_EventMemory *prev = NULL, *entry;
|
||||
|
||||
for (entry = state->head; entry; prev = entry, entry = entry->next) {
|
||||
if (mem == entry->memory) {
|
||||
if (prev) {
|
||||
prev->next = entry->next;
|
||||
}
|
||||
if (entry == state->head) {
|
||||
state->head = entry->next;
|
||||
}
|
||||
if (entry == state->tail) {
|
||||
state->tail = prev;
|
||||
}
|
||||
SDL_free(entry);
|
||||
return (void *)mem;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SDL_FreeEventMemory(const void *mem)
|
||||
{
|
||||
SDL_EventMemoryState *state;
|
||||
|
||||
Reference in New Issue
Block a user