Move SDL_List functions to SDL_list.c to avoid more merge with eventual PR
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
diff --git a/Makefile.os2 b/Makefile.os2
index eb34494..3282156 100644
--- a/Makefile.os2
+++ b/Makefile.os2
@@ -60,7 +60,7 @@ CFLAGS_DLL+= -DHAVE_LIBUSB_H=1
# building SDL itself (for DECLSPEC):
CFLAGS_DLL+= -DBUILD_SDL
-SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c
+SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c
SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc32.c
SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c
SRCS+= SDL_rwops.c SDL_power.c
diff --git a/VisualC-WinRT/SDL-UWP.vcxproj b/VisualC-WinRT/SDL-UWP.vcxproj
index e2dc5eb..681f623 100644
--- a/VisualC-WinRT/SDL-UWP.vcxproj
+++ b/VisualC-WinRT/SDL-UWP.vcxproj
@@ -144,6 +144,7 @@
<ClInclude Include="..\src\SDL_fatal.h" />
<ClInclude Include="..\src\SDL_hints_c.h" />
<ClInclude Include="..\src\SDL_internal.h" />
+ <ClInclude Include="..\src\SDL_list.h" />
<ClInclude Include="..\src\sensor\dummy\SDL_dummysensor.h" />
<ClInclude Include="..\src\sensor\SDL_sensor_c.h" />
<ClInclude Include="..\src\sensor\SDL_syssensor.h" />
@@ -295,6 +296,7 @@
<ClCompile Include="..\src\SDL.c" />
<ClCompile Include="..\src\SDL_assert.c" />
<ClCompile Include="..\src\SDL_dataqueue.c" />
+ <ClCompile Include="..\src\SDL_list.c" />
<ClCompile Include="..\src\SDL_error.c" />
<ClCompile Include="..\src\SDL_hints.c" />
<ClCompile Include="..\src\SDL_log.c" />
diff --git a/VisualC-WinRT/SDL-UWP.vcxproj.filters b/VisualC-WinRT/SDL-UWP.vcxproj.filters
index 2742449..b9a9f82 100644
--- a/VisualC-WinRT/SDL-UWP.vcxproj.filters
+++ b/VisualC-WinRT/SDL-UWP.vcxproj.filters
@@ -411,6 +411,9 @@
<ClInclude Include="..\src\SDL_dataqueue.h">
<Filter>Source Files</Filter>
</ClInclude>
+ <ClInclude Include="..\src\SDL_list.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
<ClInclude Include="..\src\haptic\windows\SDL_xinputhaptic_c.h">
<Filter>Source Files</Filter>
</ClInclude>
@@ -780,6 +783,9 @@
<ClCompile Include="..\src\SDL_dataqueue.c">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\SDL_list.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\src\haptic\windows\SDL_dinputhaptic.c">
<Filter>Source Files</Filter>
</ClCompile>
@@ -819,4 +825,4 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj
index 0e9062b..0d1ab30 100644
--- a/VisualC/SDL/SDL.vcxproj
+++ b/VisualC/SDL/SDL.vcxproj
@@ -369,6 +369,7 @@
<ClInclude Include="..\..\src\SDL_error_c.h" />
<ClInclude Include="..\..\src\SDL_hints_c.h" />
<ClInclude Include="..\..\src\SDL_internal.h" />
+ <ClInclude Include="..\..\src\SDL_list.h" />
<ClInclude Include="..\..\src\sensor\dummy\SDL_dummysensor.h" />
<ClInclude Include="..\..\src\sensor\SDL_sensor_c.h" />
<ClInclude Include="..\..\src\sensor\SDL_syssensor.h" />
@@ -543,6 +544,7 @@
<ClCompile Include="..\..\src\SDL.c" />
<ClCompile Include="..\..\src\SDL_assert.c" />
<ClCompile Include="..\..\src\SDL_dataqueue.c" />
+ <ClCompile Include="..\..\src\SDL_list.c" />
<ClCompile Include="..\..\src\SDL_error.c" />
<ClCompile Include="..\..\src\SDL_hints.c" />
<ClCompile Include="..\..\src\SDL_log.c" />
diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters
index da002cd..12162e4 100644
--- a/VisualC/SDL/SDL.vcxproj.filters
+++ b/VisualC/SDL/SDL.vcxproj.filters
@@ -401,6 +401,7 @@
</ClInclude>
<ClInclude Include="..\..\src\SDL_dataqueue.h" />
<ClInclude Include="..\..\src\SDL_error_c.h" />
+ <ClInclude Include="..\..\src\SDL_list.h" />
<ClInclude Include="..\..\include\SDL_metal.h">
<Filter>API Headers</Filter>
</ClInclude>
@@ -832,6 +833,7 @@
<ClCompile Include="..\..\src\SDL_dataqueue.c" />
<ClCompile Include="..\..\src\SDL_error.c" />
<ClCompile Include="..\..\src\SDL_hints.c" />
+ <ClCompile Include="..\..\src\SDL_list.c" />
<ClCompile Include="..\..\src\audio\SDL_audio.c">
<Filter>audio</Filter>
</ClCompile>
diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c
index b76161d..858ccba 100644
--- a/src/video/SDL_pixels.c
+++ b/src/video/SDL_pixels.c
@@ -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)
{