SDL-1.2: SDL_video.c (SDL_VideoInit): fixed a 'may be used uninitialized' warning

From d506078967c4aa6676f020185e8ad06a63dc74d2 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 23 Nov 2021 10:01:02 +0300
Subject: [PATCH] SDL_video.c (SDL_VideoInit): fixed a 'may be used
 uninitialized' warning

src/video/SDL_video.c: In function 'SDL_VideoInit':
src/video/SDL_video.c:160: warning: 'i' may be used uninitialized in this function
---
 src/audio/SDL_audio.c | 9 +++------
 src/video/SDL_video.c | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index ad512f24..9f0a6990 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -271,7 +271,7 @@ static Uint16 SDL_ParseAudioFormat(const char *string)
 int SDL_AudioInit(const char *driver_name)
 {
 	SDL_AudioDevice *audio;
-	int i = 0, idx;
+	int i, idx;
 
 	/* Check to make sure we don't overwrite 'current_audio' */
 	if ( current_audio != NULL ) {
@@ -280,7 +280,7 @@ int SDL_AudioInit(const char *driver_name)
 
 	/* Select the proper audio driver */
 	audio = NULL;
-	idx = 0;
+	i = idx = 0;
 #if SDL_AUDIO_DRIVER_ESD
 	if ( (driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL) ) {
 		/* Ahem, we know that if ESPEAKER is set, user probably wants
@@ -348,9 +348,7 @@ int SDL_AudioInit(const char *driver_name)
 		}
 		if ( audio == NULL ) {
 			SDL_SetError("No available audio device");
-#if 0 /* Don't fail SDL_Init() if audio isn't available.
-         SDL_OpenAudio() will handle it at that point.  *sigh*
-       */
+#if 0 /* Don't fail SDL_Init() if audio isn't available. SDL_OpenAudio() will handle it at that point. sigh.. */
 			return(-1);
 #endif
 		}
@@ -681,4 +679,3 @@ void SDL_Audio_SetCaption(const char *caption)
 		current_audio->SetCaption(current_audio, caption);
 	}
 }
-
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index f6c9629b..ba27a008 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -177,7 +177,7 @@ int SDL_VideoInit (const char *driver_name, Uint32 flags)
 	}
 
 	/* Select the proper video driver */
-	index = 0;
+	i = index = 0;
 	video = NULL;
 	if ( driver_name != NULL ) {
 		const char *driver_attempt = driver_name;