From 1300e2088c5f46866cc88b640035fd93aee63303 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 3 Jul 2023 17:01:10 +0300
Subject: [PATCH] removed SDL2 version-related remnants for SDL_strtokr()
---
src/codecs/timidity/timidity.c | 1 -
src/utils.c | 70 ----------------------------------
src/utils.h | 8 ----
3 files changed, 79 deletions(-)
diff --git a/src/codecs/timidity/timidity.c b/src/codecs/timidity/timidity.c
index 96ff8104..d95a9f58 100644
--- a/src/codecs/timidity/timidity.c
+++ b/src/codecs/timidity/timidity.c
@@ -7,7 +7,6 @@
*/
#include <SDL3/SDL.h>
-#include "../../utils.h" /* for SDL_strtokr() */
#include "timidity.h"
diff --git a/src/utils.c b/src/utils.c
index 95cdf425..2b0a99ed 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -24,76 +24,6 @@
#include "utils.h"
#include <stddef.h>
-#if !defined(HAVE_SDL_STRTOKR)
-/*
- * Adapted from _PDCLIB_strtok() of PDClib library at
- * https://github.com/DevSolar/pdclib.git
- *
- * The code was under CC0 license:
- * https://creativecommons.org/publicdomain/zero/1.0/legalcode :
- *
- * No Copyright
- *
- * The person who associated a work with this deed has dedicated the
- * work to the public domain by waiving all of his or her rights to
- * the work worldwide under copyright law, including all related and
- * neighboring rights, to the extent allowed by law.
- *
- * You can copy, modify, distribute and perform the work, even for
- * commercial purposes, all without asking permission. See Other
- * Information below.
- */
-char *SDL_strtokr(char *s1, const char *s2, char **ptr)
-{
- const char *p = s2;
-
- if (!s2 || !ptr || (!s1 && !*ptr)) return NULL;
-
- if (s1 != NULL) { /* new string */
- *ptr = s1;
- } else { /* old string continued */
- if (*ptr == NULL) {
- /* No old string, no new string, nothing to do */
- return NULL;
- }
- s1 = *ptr;
- }
-
- /* skip leading s2 characters */
- while (*p && *s1) {
- if (*s1 == *p) {
- /* found separator; skip and start over */
- ++s1;
- p = s2;
- continue;
- }
- ++p;
- }
-
- if (! *s1) { /* no more to parse */
- *ptr = s1;
- return NULL;
- }
-
- /* skipping non-s2 characters */
- *ptr = s1;
- while (**ptr) {
- p = s2;
- while (*p) {
- if (**ptr == *p++) {
- /* found separator; overwrite with '\0', position *ptr, return */
- *((*ptr)++) = '\0';
- return s1;
- }
- }
- ++(*ptr);
- }
-
- /* parsed to end of string */
- return s1;
-}
-#endif /* HAVE_SDL_STRTOKR */
-
/* Is given tag a loop tag? */
SDL_bool _Mix_IsLoopTag(const char *tag)
{
diff --git a/src/utils.h b/src/utils.h
index ace4f80d..4a4635f6 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -25,14 +25,6 @@
/* misc helper routines */
#include <SDL3/SDL_stdinc.h>
-#include <SDL3/SDL_version.h>
-
-#if SDL_VERSION_ATLEAST(2,0,12)
-#define HAVE_SDL_STRTOKR
-#else
-#define SDL_strtokr _MIX_strtokr
-extern char *SDL_strtokr(char *s1, const char *s2, char **saveptr);
-#endif
/* Parse time string of the form HH:MM:SS.mmm and return equivalent sample
* position */