Move SDL_List functions to SDL_list.c to avoid more merge with eventual PR

This commit is contained in:
Sylvain
2022-04-01 07:59:16 +02:00
parent 0d7edcb703
commit ad6bc521bd
6 changed files with 15 additions and 42 deletions

View File

@@ -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)
{