Removed __PHYSFS_convertToDependent(), as dead code.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 15 Mar 2012 00:40:00 -0400
changeset 1224 51a6cd2ad280
parent 1223 0b8f11836561
child 1225 671d4ea47c13
Removed __PHYSFS_convertToDependent(), as dead code.
src/physfs.c
src/physfs_internal.h
--- a/src/physfs.c	Wed Mar 14 21:24:32 2012 -0400
+++ b/src/physfs.c	Thu Mar 15 00:40:00 2012 -0400
@@ -1680,77 +1680,6 @@
 } /* PHYSFS_symbolicLinksPermitted */
 
 
-/* string manipulation in C makes my ass itch. */
-char *__PHYSFS_convertToDependent(const char *prepend,
-                                  const char *dirName,
-                                  const char *append)
-{
-    const char *dirsep = __PHYSFS_platformDirSeparator;
-    size_t sepsize = strlen(dirsep);
-    char *str;
-    char *i1;
-    char *i2;
-    size_t allocSize;
-
-    while (*dirName == '/')  /* !!! FIXME: pass through sanitize function. */
-        dirName++;
-
-    allocSize = strlen(dirName) + 1;
-    if (prepend != NULL)
-        allocSize += strlen(prepend) + sepsize;
-    if (append != NULL)
-        allocSize += strlen(append) + sepsize;
-
-    /* make sure there's enough space if the dir separator is bigger. */
-    if (sepsize > 1)
-    {
-        str = (char *) dirName;
-        do
-        {
-            str = strchr(str, '/');
-            if (str != NULL)
-            {
-                allocSize += (sepsize - 1);
-                str++;
-            } /* if */
-        } while (str != NULL);
-    } /* if */
-
-    str = (char *) allocator.Malloc(allocSize);
-    BAIL_IF_MACRO(str == NULL, ERR_OUT_OF_MEMORY, NULL);
-
-    if (prepend == NULL)
-        *str = '\0';
-    else
-    {
-        strcpy(str, prepend);
-        strcat(str, dirsep);
-    } /* else */
-
-    for (i1 = (char *) dirName, i2 = str + strlen(str); *i1; i1++, i2++)
-    {
-        if (*i1 == '/')
-        {
-            strcpy(i2, dirsep);
-            i2 += sepsize;
-        } /* if */
-        else
-        {
-            *i2 = *i1;
-        } /* else */
-    } /* for */
-    *i2 = '\0';
-
-    if (append)
-    {
-        strcat(str, dirsep);
-        strcat(str, append);
-    } /* if */
-
-    return str;
-} /* __PHYSFS_convertToDependent */
-
-
 /*
  * Verify that (fname) (in platform-independent notation), in relation
  *  to (h) is secure. That means that each element of fname is checked
--- a/src/physfs_internal.h	Wed Mar 14 21:24:32 2012 -0400
+++ b/src/physfs_internal.h	Thu Mar 15 00:40:00 2012 -0400
@@ -849,24 +849,6 @@
 void __PHYSFS_setError(const char *err);
 
 
-/*
- * Convert (dirName) to platform-dependent notation, then prepend (prepend)
- *  and append (append) to the converted string.
- *
- *  So, on Win32, calling:
- *     __PHYSFS_convertToDependent("C:\", "my/files", NULL);
- *  ...will return the string "C:\my\files".
- *
- * This is a convenience function; you might want to hack something out that
- *  is less generic (and therefore more efficient).
- *
- * Be sure to allocator.Free() the return value when done with it.
- */
-char *__PHYSFS_convertToDependent(const char *prepend,
-                                  const char *dirName,
-                                  const char *append);
-
-
 /* This byteorder stuff was lifted from SDL. http://www.libsdl.org/ */
 #define PHYSFS_LIL_ENDIAN  1234
 #define PHYSFS_BIG_ENDIAN  4321
@@ -1265,14 +1247,6 @@
  *     __PHYSFS_platformCvtToDependent("C:\", "my/files", NULL);
  *  ...will return the string "C:\my\files".
  *
- * This can be implemented in a platform-specific manner, so you can get
- *  get a speed boost that the default implementation can't, since
- *  you can make assumptions about the size of strings, etc..
- *
- * Platforms that choose not to implement this may just call
- *  __PHYSFS_convertToDependent() as a passthrough, which may fit the bill
- *  already.
- *
  * Be sure to allocator.Free() the return value when done with it.
  */
 char *__PHYSFS_platformCvtToDependent(const char *prepend,