[pypy-svn] r45683 - pypy/branch/pypy-more-rtti-inprogress/translator/c/src
arigo at codespeak.net
arigo at codespeak.net
Wed Aug 15 16:29:21 CEST 2007
Author: arigo
Date: Wed Aug 15 16:29:20 2007
New Revision: 45683
Modified:
pypy/branch/pypy-more-rtti-inprogress/translator/c/src/ll_os.h
Log:
Kill dead code.
Modified: pypy/branch/pypy-more-rtti-inprogress/translator/c/src/ll_os.h
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/translator/c/src/ll_os.h (original)
+++ pypy/branch/pypy-more-rtti-inprogress/translator/c/src/ll_os.h Wed Aug 15 16:29:20 2007
@@ -57,12 +57,6 @@
long LL_os_spawnv(int mode, RPyString *path, RPyListOfString *args);
#endif
void LL_os__exit(long status);
-void LL_os_putenv(RPyString * name_eq_value);
-void LL_os_unsetenv(RPyString * name);
-RPyString* LL_os_environ(int idx);
-struct RPyOpaque_DIR *LL_os_opendir(RPyString *dirname);
-RPyString *LL_os_readdir(struct RPyOpaque_DIR *dir);
-void LL_os_closedir(struct RPyOpaque_DIR *dir);
static int geterrno(void)
{
@@ -246,154 +240,4 @@
_exit((int)status);
}
-#ifdef HAVE_PUTENV
-/* Note that this doesn't map to os.putenv, it is the name=value
- * version of C. See ros.py for the fake implementation.
- * Also note that we are responsible to keep the
- * value alive. This is done in interp_posix.py
- */
-void LL_os_putenv(RPyString * name_eq_value) {
- int error = putenv(RPyString_AsString(name_eq_value));
- if (error != 0) {
- RPYTHON_RAISE_OSERROR(errno);
- }
-}
-#endif
-
-#ifdef HAVE_UNSETENV
-void LL_os_unsetenv(RPyString * name) {
- unsetenv(RPyString_AsString(name));
-}
-#endif
-
-/* Return a dictionary corresponding to the POSIX environment table */
-/*** actually, we create a string list here and do the rest in posix */
-
-RPyString* LL_os_environ(int idx) {
- RPyString *rs = NULL;
- char *s;
-#ifdef WITH_NEXT_FRAMEWORK
- if (environ == NULL)
- environ = *_NSGetEnviron();
-#endif
- if (environ != NULL && (s = environ[idx]) != NULL) {
- rs = RPyString_FromString(s);
- }
- return rs;
-}
-
-/******************** opendir/readdir/closedir ********************/
-/* XXX old interface no longer used in PyPy, will be removed at some point */
-#if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR)
-
-/* emulation of opendir, readdir, closedir */
-
-/*
- the problem is that Windows does not have something like
- opendir. Instead, FindFirstFile creates a handle and
- yields the first entry found. Furthermore, we need
- to mangle the filename.
- To keep the rpython interface, we need to buffer the
- first result and let readdir return this first time.
- Drawback of this approach: we need to use malloc,
- and the way I'm emulating dirent is maybe somewhat hackish.
-
- XXX we are lacking unicode support, completely.
- Might need a different interface.
- */
-
-#undef dirent
-
-typedef struct dirent {
- HANDLE hFind;
- WIN32_FIND_DATA FileData;
- char *d_name; /* faking dirent */
- char arg[1]; /*also used as flag */
-} DIR;
-
-/* XXX old interface no longer used in PyPy, will be removed at some point */
-static DIR *opendir(char *dirname)
-{
- int lng = strlen(dirname);
- DIR *d = malloc(sizeof(DIR) + lng + 4);
-
- if (d != NULL) {
- char *ptr = (char*)d->arg;
- strcpy(ptr, dirname);
- strcpy(ptr + lng, "\\*.*" + (*(ptr + lng - 1) == '\\'));
- d->hFind = FindFirstFile(ptr, &d->FileData);
- d->d_name = d->FileData.cFileName;
- if (d->hFind == INVALID_HANDLE_VALUE) {
- d->d_name = NULL;
- if (GetLastError() != ERROR_FILE_NOT_FOUND) {
- errno = GetLastError();
- free(d);
- d = NULL;
- }
- }
- }
- return d;
-}
-
-/* XXX old interface no longer used in PyPy, will be removed at some point */
-static struct dirent *readdir(DIR *d)
-{
- if (d->arg[0])
- d->arg[0] = 0; /* use existing result first time */
- else {
- if (FindNextFile(d->hFind, &d->FileData))
- d->d_name = d->FileData.cFileName;
- else {
- d->d_name = NULL;
- if (GetLastError() != ERROR_NO_MORE_FILES)
- errno = GetLastError();
- }
- }
- return d->d_name ? d : NULL;
-}
-
-/* XXX old interface no longer used in PyPy, will be removed at some point */
-static int closedir(DIR *d)
-{
- HANDLE hFind = d->hFind;
-
- free(d);
- if (FindClose(hFind) == 0) {
- errno = GetLastError();
- return -1;
- }
- return 0;
-}
-
-#endif /* defined(MS_WINDOWS) && !defined(HAVE_OPENDIR) */
-
-/* XXX old interface no longer used in PyPy, will be removed at some point */
-struct RPyOpaque_DIR *LL_os_opendir(RPyString *dirname)
-{
- DIR *dir = opendir(RPyString_AsString(dirname));
- if (dir == NULL)
- RPYTHON_RAISE_OSERROR(errno);
- return (struct RPyOpaque_DIR *) dir;
-}
-
-/* XXX old interface no longer used in PyPy, will be removed at some point */
-RPyString *LL_os_readdir(struct RPyOpaque_DIR *dir)
-{
- struct dirent *d;
- errno = 0;
- d = readdir((DIR *) dir);
- if (d != NULL)
- return RPyString_FromString(d->d_name);
- if (errno)
- RPYTHON_RAISE_OSERROR(errno);
- return NULL;
-}
-
-/* XXX old interface no longer used in PyPy, will be removed at some point */
-void LL_os_closedir(struct RPyOpaque_DIR *dir)
-{
- if (closedir((DIR *) dir) < 0)
- RPYTHON_RAISE_OSERROR(errno);
-}
-
#endif /* PYPY_NOT_MAIN_FILE */
More information about the Pypy-commit
mailing list