From 5109e1993571143461c87ef09ce2aeccd3bcac09 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Thu, 16 Mar 2023 00:04:02 +0100
Subject: [PATCH] SDL_test: remove unused BuildCommonUsageString
---
include/SDL3/SDL_test_common.h | 13 ---------
src/test/SDL_test_common.c | 53 ----------------------------------
2 files changed, 66 deletions(-)
diff --git a/include/SDL3/SDL_test_common.h b/include/SDL3/SDL_test_common.h
index 9e44e7b1275f..daed5c0a6722 100644
--- a/include/SDL3/SDL_test_common.h
+++ b/include/SDL3/SDL_test_common.h
@@ -170,19 +170,6 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index);
*/
void SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const char **options);
-/**
- * \brief Returns common usage information
- *
- * You should (probably) be using SDLTest_CommonLogUsage() instead, but this
- * function remains for binary compatibility. Strings returned from this
- * function are valid until SDLTest_CommonQuit() is called, in which case
- * those strings' memory is freed and can no longer be used.
- *
- * \param state The common state describing the test window to create.
- * \returns a string with usage information
- */
-const char *SDLTest_CommonUsage(SDLTest_CommonState *state);
-
/**
* \brief Open test window.
*
diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index 4c7fd681ca70..cd4831f3f034 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -630,63 +630,10 @@ void SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const
}
}
-static const char *BuildCommonUsageString(char **pstr, const char **strlist, const int numitems, const char **strlist2, const int numitems2)
-{
- char *str = *pstr;
- if (str == NULL) {
- size_t len = SDL_strlen("[--trackmem]") + 2;
- int i;
- for (i = 0; i < numitems; i++) {
- len += SDL_strlen(strlist[i]) + 1;
- }
- if (strlist2) {
- for (i = 0; i < numitems2; i++) {
- len += SDL_strlen(strlist2[i]) + 1;
- }
- }
- str = (char *)SDL_calloc(1, len);
- if (str == NULL) {
- return ""; /* oh well. */
- }
- SDL_strlcat(str, "[--trackmem] ", len);
- for (i = 0; i < numitems - 1; i++) {
- SDL_strlcat(str, strlist[i], len);
- SDL_strlcat(str, " ", len);
- }
- SDL_strlcat(str, strlist[i], len);
- if (strlist2) {
- SDL_strlcat(str, " ", len);
- for (i = 0; i < numitems2 - 1; i++) {
- SDL_strlcat(str, strlist2[i], len);
- SDL_strlcat(str, " ", len);
- }
- SDL_strlcat(str, strlist2[i], len);
- }
- *pstr = str;
- }
- return str;
-}
-
static char *common_usage_video = NULL;
static char *common_usage_audio = NULL;
static char *common_usage_videoaudio = NULL;
-const char *
-SDLTest_CommonUsage(SDLTest_CommonState *state)
-{
-
- switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
- case SDL_INIT_VIDEO:
- return BuildCommonUsageString(&common_usage_video, video_usage, SDL_arraysize(video_usage), NULL, 0);
- case SDL_INIT_AUDIO:
- return BuildCommonUsageString(&common_usage_audio, audio_usage, SDL_arraysize(audio_usage), NULL, 0);
- case (SDL_INIT_VIDEO | SDL_INIT_AUDIO):
- return BuildCommonUsageString(&common_usage_videoaudio, video_usage, SDL_arraysize(video_usage), audio_usage, SDL_arraysize(audio_usage));
- default:
- return "[--trackmem]";
- }
-}
-
SDL_bool
SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv)
{