foxygit / doom Log in
commit bb9207f9fad7b1ec72860a240454a46042f29f89
Author:     mfrancis95 <mikefrancis95@gmail.com>
AuthorDate: Sat Jun 27 13:55:11 2020 -0400
Commit:     mfrancis95 <mikefrancis95@gmail.com>
CommitDate: Sat Jun 27 14:34:45 2020 -0400

    Move M_NormalizeSlashes from strife/m_saves to m_misc
---
 src/m_misc.c         | 33 +++++++++++++++++++++++++++++++++
 src/m_misc.h         |  1 +
 src/strife/m_saves.c | 34 ----------------------------------
 src/strife/m_saves.h |  1 -
 4 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/src/m_misc.c b/src/m_misc.c
index 1f8117be..4ed7cae5 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -661,3 +661,36 @@ char *M_OEMToUTF8(const char *oem)

 #endif

+//
+// M_NormalizeSlashes
+//
+// Remove trailing slashes, translate backslashes to slashes
+// The string to normalize is passed and returned in str
+//
+// killough 11/98: rewritten
+//
+// [STRIFE] - haleyjd 20110210: Borrowed from Eternity and adapted to respect
+// the DIR_SEPARATOR define used by Choco Doom. This routine originated in
+// BOOM.
+//
+void M_NormalizeSlashes(char *str)
+{
+    char *p;
+
+    // Convert all slashes/backslashes to DIR_SEPARATOR
+    for(p = str; *p; p++)
+    {
+        if((*p == '/' || *p == '\\') && *p != DIR_SEPARATOR)
+            *p = DIR_SEPARATOR;
+    }
+
+    // Remove trailing slashes
+    while(p > str && *--p == DIR_SEPARATOR)
+        *p = 0;
+
+    // Collapse multiple slashes
+    for(p = str; (*str++ = *p); )
+        if(*p++ == DIR_SEPARATOR)
+            while(*p == DIR_SEPARATOR)
+                p++;
+}
\ No newline at end of file
diff --git a/src/m_misc.h b/src/m_misc.h
index 90855d18..35bf9b41 100644
--- a/src/m_misc.h
+++ b/src/m_misc.h
@@ -50,6 +50,7 @@ boolean M_StringEndsWith(const char *s, const char *suffix);
 int M_vsnprintf(char *buf, size_t buf_len, const char *s, va_list args);
 int M_snprintf(char *buf, size_t buf_len, const char *s, ...) PRINTF_ATTR(3, 4);
 char *M_OEMToUTF8(const char *ansi);
+void M_NormalizeSlashes(char *str);

 #endif

diff --git a/src/strife/m_saves.c b/src/strife/m_saves.c
index c2f6b7d0..ab677465 100644
--- a/src/strife/m_saves.c
+++ b/src/strife/m_saves.c
@@ -361,40 +361,6 @@ int M_StringAlloc(char **str, int numstrs, size_t extra, const char *str1, ...)
     return len;
 }

-//
-// M_NormalizeSlashes
-//
-// Remove trailing slashes, translate backslashes to slashes
-// The string to normalize is passed and returned in str
-//
-// killough 11/98: rewritten
-//
-// [STRIFE] - haleyjd 20110210: Borrowed from Eternity and adapted to respect
-// the DIR_SEPARATOR define used by Choco Doom. This routine originated in
-// BOOM.
-//
-void M_NormalizeSlashes(char *str)
-{
-    char *p;
-
-    // Convert all slashes/backslashes to DIR_SEPARATOR
-    for(p = str; *p; p++)
-    {
-        if((*p == '/' || *p == '\\') && *p != DIR_SEPARATOR)
-            *p = DIR_SEPARATOR;
-    }
-
-    // Remove trailing slashes
-    while(p > str && *--p == DIR_SEPARATOR)
-        *p = 0;
-
-    // Collapse multiple slashes
-    for(p = str; (*str++ = *p); )
-        if(*p++ == DIR_SEPARATOR)
-            while(*p == DIR_SEPARATOR)
-                p++;
-}
-
 //
 // M_SafeFilePath
 //
diff --git a/src/strife/m_saves.h b/src/strife/m_saves.h
index 8b6bcede..ce278cba 100644
--- a/src/strife/m_saves.h
+++ b/src/strife/m_saves.h
@@ -42,7 +42,6 @@ void    M_ReadMisObj(void);

 // Custom Utilities for Filepath Handling
 void *M_Calloc(size_t n1, size_t n2);
-void  M_NormalizeSlashes(char *str);
 int   M_StringAlloc(char **str, int numstrs, size_t extra, const char *str1, ...);
 char *M_SafeFilePath(const char *basepath, const char *newcomponent);
 char  M_GetFilePath(const char *fn, char *dest, size_t len);