Skip to content

Commit

Permalink
Apparently, __PHYSFS_platformCurrentDir() is dead code.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Mar 13, 2012
1 parent 0ae446d commit c57bd94
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 73 deletions.
10 changes: 0 additions & 10 deletions src/physfs_internal.h
Expand Up @@ -1294,16 +1294,6 @@ void __PHYSFS_platformEnumerateFiles(const char *dirname,
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
Expand Down
38 changes: 0 additions & 38 deletions src/platform_posix.c
Expand Up @@ -221,44 +221,6 @@ void __PHYSFS_platformEnumerateFiles(const char *dirname,
} /* __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;
Expand Down
25 changes: 0 additions & 25 deletions src/platform_windows.c
Expand Up @@ -557,31 +557,6 @@ void __PHYSFS_platformEnumerateFiles(const char *dirname,
} /* __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;
Expand Down

0 comments on commit c57bd94

Please sign in to comment.