mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-27 21:48:29 +00:00
Move SDL_List functions to SDL_list.c to avoid more merge with eventual PR
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "SDL_blit.h"
|
||||
#include "SDL_pixels_c.h"
|
||||
#include "SDL_RLEaccel_c.h"
|
||||
#include "../SDL_list.h"
|
||||
|
||||
|
||||
/* Lookup tables to expand partial bytes to the full 0..255 range */
|
||||
@@ -1024,12 +1025,6 @@ SDL_AllocBlitMap(void)
|
||||
}
|
||||
|
||||
|
||||
typedef struct SDL_ListNode
|
||||
{
|
||||
void *entry;
|
||||
struct SDL_ListNode *next;
|
||||
} SDL_ListNode;
|
||||
|
||||
void
|
||||
SDL_InvalidateAllBlitMap(SDL_Surface *surface)
|
||||
{
|
||||
@@ -1045,40 +1040,6 @@ SDL_InvalidateAllBlitMap(SDL_Surface *surface)
|
||||
}
|
||||
}
|
||||
|
||||
static void SDL_ListAdd(SDL_ListNode **head, void *ent);
|
||||
static void SDL_ListRemove(SDL_ListNode **head, void *ent);
|
||||
|
||||
void
|
||||
SDL_ListAdd(SDL_ListNode **head, void *ent)
|
||||
{
|
||||
SDL_ListNode *node = SDL_malloc(sizeof (*node));
|
||||
|
||||
if (node == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return;
|
||||
}
|
||||
|
||||
node->entry = ent;
|
||||
node->next = *head;
|
||||
*head = node;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_ListRemove(SDL_ListNode **head, void *ent)
|
||||
{
|
||||
SDL_ListNode **ptr = head;
|
||||
|
||||
while (*ptr) {
|
||||
if ((*ptr)->entry == ent) {
|
||||
SDL_ListNode *tmp = *ptr;
|
||||
*ptr = (*ptr)->next;
|
||||
SDL_free(tmp);
|
||||
return;
|
||||
}
|
||||
ptr = &(*ptr)->next;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SDL_InvalidateMap(SDL_BlitMap * map)
|
||||
{
|
||||
|
Reference in New Issue
Block a user