SDL: video: removed unused devindex argument from bootstrap's create method.

From 20a76b0e3e73001603c265d0b8fe3b46d15d3ece Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 25 Jul 2022 23:06:58 -0400
Subject: [PATCH] video: removed unused devindex argument from bootstrap's
 create method.

---
 src/video/SDL_sysvideo.h                   |  2 +-
 src/video/SDL_video.c                      |  8 +++-----
 src/video/android/SDL_androidvideo.c       |  2 +-
 src/video/cocoa/SDL_cocoavideo.m           |  2 +-
 src/video/directfb/SDL_DirectFB_video.c    |  4 ++--
 src/video/dummy/SDL_nullvideo.c            |  2 +-
 src/video/emscripten/SDL_emscriptenvideo.c |  2 +-
 src/video/haiku/SDL_bvideo.cc              |  2 +-
 src/video/kmsdrm/SDL_kmsdrmvideo.c         |  3 ++-
 src/video/nacl/SDL_naclvideo.c             |  2 +-
 src/video/ngage/SDL_ngagevideo.cpp         |  2 +-
 src/video/offscreen/SDL_offscreenvideo.c   |  2 +-
 src/video/os2/SDL_os2video.c               | 10 +++++-----
 src/video/riscos/SDL_riscosvideo.c         |  2 +-
 src/video/uikit/SDL_uikitvideo.m           |  2 +-
 src/video/wayland/SDL_waylandvideo.c       |  2 +-
 src/video/windows/SDL_windowsvideo.c       |  2 +-
 src/video/winrt/SDL_winrtvideo.cpp         |  2 +-
 src/video/x11/SDL_x11video.c               |  2 +-
 19 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index 9e2bfb9ea77..fe643a4437d 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -432,7 +432,7 @@ typedef struct VideoBootStrap
 {
     const char *name;
     const char *desc;
-    SDL_VideoDevice *(*create) (int devindex);
+    SDL_VideoDevice *(*create) (void);
 } VideoBootStrap;
 
 /* Not all of these are available in a given build. Use #ifdefs, etc. */
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 144326f5434..d1ce9d45f23 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -391,12 +391,11 @@ int
 SDL_VideoInit(const char *driver_name)
 {
     SDL_VideoDevice *video;
-    int index;
-    int i;
     SDL_bool init_events = SDL_FALSE;
     SDL_bool init_keyboard = SDL_FALSE;
     SDL_bool init_mouse = SDL_FALSE;
     SDL_bool init_touch = SDL_FALSE;
+    int i;
 
     /* Check to make sure we don't overwrite '_this' */
     if (_this != NULL) {
@@ -426,7 +425,6 @@ SDL_VideoInit(const char *driver_name)
     init_touch = SDL_TRUE;
 
     /* Select the proper video driver */
-    i = index = 0;
     video = NULL;
     if (driver_name == NULL) {
         driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER);
@@ -441,7 +439,7 @@ SDL_VideoInit(const char *driver_name)
             for (i = 0; bootstrap[i]; ++i) {
                 if ((driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
                     (SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) {
-                    video = bootstrap[i]->create(index);
+                    video = bootstrap[i]->create();
                     break;
                 }
             }
@@ -450,7 +448,7 @@ SDL_VideoInit(const char *driver_name)
         }
     } else {
         for (i = 0; bootstrap[i]; ++i) {
-            video = bootstrap[i]->create(index);
+            video = bootstrap[i]->create();
             if (video != NULL) {
                 break;
             }
diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c
index 9555ea0780b..c596df8b29d 100644
--- a/src/video/android/SDL_androidvideo.c
+++ b/src/video/android/SDL_androidvideo.c
@@ -84,7 +84,7 @@ Android_DeleteDevice(SDL_VideoDevice *device)
 }
 
 static SDL_VideoDevice *
-Android_CreateDevice(int devindex)
+Android_CreateDevice(void)
 {
     SDL_VideoDevice *device;
     SDL_VideoData *data;
diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m
index 1df31f64823..987fa2d4dd0 100644
--- a/src/video/cocoa/SDL_cocoavideo.m
+++ b/src/video/cocoa/SDL_cocoavideo.m
@@ -55,7 +55,7 @@ @implementation SDL_VideoData
 }}
 
 static SDL_VideoDevice *
-Cocoa_CreateDevice(int devindex)
+Cocoa_CreateDevice(void)
 { @autoreleasepool
 {
     SDL_VideoDevice *device;
diff --git a/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c
index cce1ee5fe8e..22badec67c0 100644
--- a/src/video/directfb/SDL_DirectFB_video.c
+++ b/src/video/directfb/SDL_DirectFB_video.c
@@ -61,7 +61,7 @@
 static int DirectFB_VideoInit(_THIS);
 static void DirectFB_VideoQuit(_THIS);
 
-static SDL_VideoDevice *DirectFB_CreateDevice(int devindex);
+static SDL_VideoDevice *DirectFB_CreateDevice(void);
 
 VideoBootStrap DirectFB_bootstrap = {
     "directfb", "DirectFB",
@@ -83,7 +83,7 @@ DirectFB_DeleteDevice(SDL_VideoDevice * device)
 }
 
 static SDL_VideoDevice *
-DirectFB_CreateDevice(int devindex)
+DirectFB_CreateDevice(void)
 {
     SDL_VideoDevice *device;
 
diff --git a/src/video/dummy/SDL_nullvideo.c b/src/video/dummy/SDL_nullvideo.c
index a7fb1aac296..3e211511bc9 100644
--- a/src/video/dummy/SDL_nullvideo.c
+++ b/src/video/dummy/SDL_nullvideo.c
@@ -75,7 +75,7 @@ DUMMY_DeleteDevice(SDL_VideoDevice * device)
 }
 
 static SDL_VideoDevice *
-DUMMY_CreateDevice(int devindex)
+DUMMY_CreateDevice(void)
 {
     SDL_VideoDevice *device;
 
diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c
index 4c6038f09ff..831af8e21ef 100644
--- a/src/video/emscripten/SDL_emscriptenvideo.c
+++ b/src/video/emscripten/SDL_emscriptenvideo.c
@@ -62,7 +62,7 @@ Emscripten_DeleteDevice(SDL_VideoDevice * device)
 }
 
 static SDL_VideoDevice *
-Emscripten_CreateDevice(int devindex)
+Emscripten_CreateDevice(void)
 {
     SDL_VideoDevice *device;
 
diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc
index 1ac3201f2f0..e409f3c6fd6 100644
--- a/src/video/haiku/SDL_bvideo.cc
+++ b/src/video/haiku/SDL_bvideo.cc
@@ -55,7 +55,7 @@ static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
 /* End undefined functions */
 
 static SDL_VideoDevice *
-HAIKU_CreateDevice(int devindex)
+HAIKU_CreateDevice(void)
 {
     SDL_VideoDevice *device;
     /*SDL_VideoData *data;*/
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 07a15ae6718..8f653b5359b 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -213,10 +213,11 @@ KMSDRM_DeleteDevice(SDL_VideoDevice * device)
 }
 
 static SDL_VideoDevice *
-KMSDRM_CreateDevice(int devindex)
+KMSDRM_CreateDevice(void)
 {
     SDL_VideoDevice *device;
     SDL_VideoData *viddata;
+    int devindex = 0;  /* !!! FIXME: let app/user specify this. */
 
     if (!KMSDRM_Available()) {
         return NULL;
diff --git a/src/video/nacl/SDL_naclvideo.c b/src/video/nacl/SDL_naclvideo.c
index 96901e899cf..986bfb31261 100644
--- a/src/video/nacl/SDL_naclvideo.c
+++ b/src/video/nacl/SDL_naclvideo.c
@@ -91,7 +91,7 @@ NACL_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
     return 0;
 }
 
-static SDL_VideoDevice *NACL_CreateDevice(int devindex) {
+static SDL_VideoDevice *NACL_CreateDevice(void) {
     SDL_VideoDevice *device;
     
     if (!NACL_Available()) {
diff --git a/src/video/ngage/SDL_ngagevideo.cpp b/src/video/ngage/SDL_ngagevideo.cpp
index eea21e8e1de..d0ed05f2093 100644
--- a/src/video/ngage/SDL_ngagevideo.cpp
+++ b/src/video/ngage/SDL_ngagevideo.cpp
@@ -108,7 +108,7 @@ NGAGE_DeleteDevice(SDL_VideoDevice * device)
 }
 
 static SDL_VideoDevice *
-NGAGE_CreateDevice(int devindex)
+NGAGE_CreateDevice(void)
 {
     SDL_VideoDevice *device;
     SDL_VideoData   *phdata;
diff --git a/src/video/offscreen/SDL_offscreenvideo.c b/src/video/offscreen/SDL_offscreenvideo.c
index 19c7cb5e518..3e1aafe3c1d 100644
--- a/src/video/offscreen/SDL_offscreenvideo.c
+++ b/src/video/offscreen/SDL_offscreenvideo.c
@@ -58,7 +58,7 @@ OFFSCREEN_DeleteDevice(SDL_VideoDevice * device)
 }
 
 static SDL_VideoDevice *
-OFFSCREEN_CreateDevice(int devindex)
+OFFSCREEN_CreateDevice(void)
 {
     SDL_VideoDevice *device;
 
diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c
index 411de8cf81a..a9599c8f3cc 100644
--- a/src/video/os2/SDL_os2video.c
+++ b/src/video/os2/SDL_os2video.c
@@ -1593,7 +1593,7 @@ static void OS2_DeleteDevice(SDL_VideoDevice *device)
     SDL_free(device);
 }
 
-static SDL_VideoDevice *OS2_CreateDevice(int devindex)
+static SDL_VideoDevice *OS2_CreateDevice(void)
 {
     SDL_VideoDevice *device;
 
@@ -1648,22 +1648,22 @@ static SDL_VideoDevice *OS2_CreateDevice(int devindex)
     return device;
 }
 
-static SDL_VideoDevice *OS2DIVE_CreateDevice(int devindex)
+static SDL_VideoDevice *OS2DIVE_CreateDevice(void)
 {
     VIDEOOUTPUTINFO stVOInfo;
     if (!voDive.QueryInfo(&stVOInfo)) {
         return NULL;
     }
-    return OS2_CreateDevice(devindex);
+    return OS2_CreateDevice();
 }
 
-static SDL_VideoDevice *OS2VMAN_CreateDevice(int devindex)
+static SDL_VideoDevice *OS2VMAN_CreateDevice(void)
 {
     VIDEOOUTPUTINFO stVOInfo;
     if (!voVMan.QueryInfo(&stVOInfo)) {
           return NULL;
     }
-    return OS2_CreateDevice(devindex);
+    return OS2_CreateDevice();
 }
 
 
diff --git a/src/video/riscos/SDL_riscosvideo.c b/src/video/riscos/SDL_riscosvideo.c
index ebd4952a59c..476301100b4 100644
--- a/src/video/riscos/SDL_riscosvideo.c
+++ b/src/video/riscos/SDL_riscosvideo.c
@@ -51,7 +51,7 @@ RISCOS_DeleteDevice(SDL_VideoDevice * device)
 }
 
 static SDL_VideoDevice *
-RISCOS_CreateDevice(int devindex)
+RISCOS_CreateDevice(void)
 {
     SDL_VideoDevice *device;
     SDL_VideoData *phdata;
diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m
index 81d7bf647a7..8afb665315d 100644
--- a/src/video/uikit/SDL_uikitvideo.m
+++ b/src/video/uikit/SDL_uikitvideo.m
@@ -61,7 +61,7 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
 }
 
 static SDL_VideoDevice *
-UIKit_CreateDevice(int devindex)
+UIKit_CreateDevice(void)
 {
     @autoreleasepool {
         SDL_VideoDevice *device;
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 1bed2b238ea..75bd80718dd 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -174,7 +174,7 @@ Wayland_DeleteDevice(SDL_VideoDevice *device)
 }
 
 static SDL_VideoDevice *
-Wayland_CreateDevice(int devindex)
+Wayland_CreateDevice(void)
 {
     SDL_VideoDevice *device;
     SDL_VideoData *data;
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index 6114808f4f3..2b3f0a49e36 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -105,7 +105,7 @@ WIN_DeleteDevice(SDL_VideoDevice * device)
 }
 
 static SDL_VideoDevice *
-WIN_CreateDevice(int devindex)
+WIN_CreateDevice(void)
 {
     SDL_VideoDevice *device;
     SDL_VideoData *data;
diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp
index e2d3f9e6d47..a71ba9b0797 100644
--- a/src/video/winrt/SDL_winrtvideo.cpp
+++ b/src/video/winrt/SDL_winrtvideo.cpp
@@ -117,7 +117,7 @@ WINRT_DeleteDevice(SDL_VideoDevice * device)
 }
 
 static SDL_VideoDevice *
-WINRT_CreateDevice(int devindex)
+WINRT_CreateDevice(void)
 {
     SDL_VideoDevice *device;
     SDL_VideoData *data;
diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c
index fc8c878fbb9..92045caa0fd 100644
--- a/src/video/x11/SDL_x11video.c
+++ b/src/video/x11/SDL_x11video.c
@@ -149,7 +149,7 @@ X11_SafetyNetErrHandler(Display * d, XErrorEvent * e)
 }
 
 static SDL_VideoDevice *
-X11_CreateDevice(int devindex)
+X11_CreateDevice(void)
 {
     SDL_VideoDevice *device;
     SDL_VideoData *data;