mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Remove unused code in posixmodule.c
This commit is contained in:
parent
bc85d848f5
commit
6c9c09058f
1 changed files with 0 additions and 68 deletions
|
|
@ -557,14 +557,6 @@ posix_error_with_filename(char* name)
|
|||
return PyErr_SetFromErrnoWithFilename(PyExc_OSError, name);
|
||||
}
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
static PyObject *
|
||||
posix_error_with_unicode_filename(Py_UNICODE* name)
|
||||
{
|
||||
return PyErr_SetFromErrnoWithUnicodeFilename(PyExc_OSError, name);
|
||||
}
|
||||
#endif /* MS_WINDOWS */
|
||||
|
||||
|
||||
static PyObject *
|
||||
posix_error_with_allocated_filename(PyObject* name)
|
||||
|
|
@ -1628,66 +1620,6 @@ _pystat_fromstructstat(STRUCT_STAT *st)
|
|||
return v;
|
||||
}
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
|
||||
/* IsUNCRoot -- test whether the supplied path is of the form \\SERVER\SHARE\,
|
||||
where / can be used in place of \ and the trailing slash is optional.
|
||||
Both SERVER and SHARE must have at least one character.
|
||||
*/
|
||||
|
||||
#define ISSLASHA(c) ((c) == '\\' || (c) == '/')
|
||||
#define ISSLASHW(c) ((c) == L'\\' || (c) == L'/')
|
||||
#ifndef ARRAYSIZE
|
||||
#define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||
#endif
|
||||
|
||||
static BOOL
|
||||
IsUNCRootA(char *path, int pathlen)
|
||||
{
|
||||
#define ISSLASH ISSLASHA
|
||||
|
||||
int i, share;
|
||||
|
||||
if (pathlen < 5 || !ISSLASH(path[0]) || !ISSLASH(path[1]))
|
||||
/* minimum UNCRoot is \\x\y */
|
||||
return FALSE;
|
||||
for (i = 2; i < pathlen ; i++)
|
||||
if (ISSLASH(path[i])) break;
|
||||
if (i == 2 || i == pathlen)
|
||||
/* do not allow \\\SHARE or \\SERVER */
|
||||
return FALSE;
|
||||
share = i+1;
|
||||
for (i = share; i < pathlen; i++)
|
||||
if (ISSLASH(path[i])) break;
|
||||
return (i != share && (i == pathlen || i == pathlen-1));
|
||||
|
||||
#undef ISSLASH
|
||||
}
|
||||
|
||||
static BOOL
|
||||
IsUNCRootW(Py_UNICODE *path, int pathlen)
|
||||
{
|
||||
#define ISSLASH ISSLASHW
|
||||
|
||||
int i, share;
|
||||
|
||||
if (pathlen < 5 || !ISSLASH(path[0]) || !ISSLASH(path[1]))
|
||||
/* minimum UNCRoot is \\x\y */
|
||||
return FALSE;
|
||||
for (i = 2; i < pathlen ; i++)
|
||||
if (ISSLASH(path[i])) break;
|
||||
if (i == 2 || i == pathlen)
|
||||
/* do not allow \\\SHARE or \\SERVER */
|
||||
return FALSE;
|
||||
share = i+1;
|
||||
for (i = share; i < pathlen; i++)
|
||||
if (ISSLASH(path[i])) break;
|
||||
return (i != share && (i == pathlen || i == pathlen-1));
|
||||
|
||||
#undef ISSLASH
|
||||
}
|
||||
#endif /* MS_WINDOWS */
|
||||
|
||||
static PyObject *
|
||||
posix_do_stat(PyObject *self, PyObject *args,
|
||||
char *format,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue