Apparently, __PHYSFS_platformCurrentDir() is dead code.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 13 Mar 2012 04:25:05 -0400
changeset 1218 643a34fc7c8f
parent 1217 e38ffad216e8
child 1219 f479c6b1e7f7
Apparently, __PHYSFS_platformCurrentDir() is dead code.
src/physfs_internal.h
src/platform_posix.c
src/platform_windows.c
--- a/src/physfs_internal.h	Mon Mar 12 04:05:31 2012 -0400
+++ b/src/physfs_internal.h	Tue Mar 13 04:25:05 2012 -0400
@@ -1294,16 +1294,6 @@
                                      const char *origdir,
                                      void *callbackdata);
 
-
-/*
- * Get the current working directory. The return value should be an
- *  absolute path in platform-dependent notation. The caller will deallocate
- *  the return value with allocator.Free() when it is done with it.
- * On error, return NULL and set the error message.
- */
-char *__PHYSFS_platformCurrentDir(void);
-
-
 /*
  * Make a directory in the actual filesystem. (path) is specified in
  *  platform-dependent notation. On error, return zero and set the error
--- a/src/platform_posix.c	Mon Mar 12 04:05:31 2012 -0400
+++ b/src/platform_posix.c	Tue Mar 13 04:25:05 2012 -0400
@@ -221,44 +221,6 @@
 } /* __PHYSFS_platformEnumerateFiles */
 
 
-char *__PHYSFS_platformCurrentDir(void)
-{
-    int allocSize = 64;
-    char *retval = NULL;
-    char *ptr;
-
-    do
-    {
-        allocSize *= 2;
-        ptr = (char *) allocator.Realloc(retval, allocSize);
-        if (ptr == NULL)
-        {
-            if (retval != NULL)
-                allocator.Free(retval);
-            BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
-        } /* if */
-
-        retval = ptr;
-        ptr = getcwd(retval, allocSize);
-    } while (ptr == NULL && errno == ERANGE);
-
-    if (ptr == NULL && errno)
-    {
-        /* getcwd() failed , for example current directory not existing... */
-        if (retval != NULL)
-            allocator.Free(retval);
-        BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
-    } /* if */
-
-    /* try to shrink buffer... */
-    ptr = (char *) allocator.Realloc(retval, strlen(retval) + 1);
-    if (ptr != NULL)
-        retval = ptr;  /* oh well if it failed. */
-
-    return retval;
-} /* __PHYSFS_platformCurrentDir */
-
-
 int __PHYSFS_platformMkDir(const char *path)
 {
     int rc;
--- a/src/platform_windows.c	Mon Mar 12 04:05:31 2012 -0400
+++ b/src/platform_windows.c	Tue Mar 13 04:25:05 2012 -0400
@@ -557,31 +557,6 @@
 } /* __PHYSFS_platformEnumerateFiles */
 
 
-char *__PHYSFS_platformCurrentDir(void)
-{
-    char *retval = NULL;
-    WCHAR *wbuf = NULL;
-    DWORD buflen = 0;
-
-    buflen = GetCurrentDirectoryW(buflen, NULL);
-    wbuf = (WCHAR *) __PHYSFS_smallAlloc((buflen + 2) * sizeof (WCHAR));
-    BAIL_IF_MACRO(wbuf == NULL, ERR_OUT_OF_MEMORY, NULL);
-    GetCurrentDirectoryW(buflen, wbuf);
-
-    if (wbuf[buflen - 2] == '\\')
-        wbuf[buflen - 1] = '\0';  /* just in case... */
-    else
-    {
-        wbuf[buflen - 1] = '\\'; 
-        wbuf[buflen] = '\0'; 
-    } /* else */
-
-    retval = unicodeToUtf8Heap(wbuf);
-    __PHYSFS_smallFree(wbuf);
-    return retval;
-} /* __PHYSFS_platformCurrentDir */
-
-
 int __PHYSFS_platformMkDir(const char *path)
 {
     WCHAR *wpath;