diff options
author | Guido van Rossum <guido@python.org> | 1995-01-02 19:30:30 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-01-02 19:30:30 (GMT) |
commit | 3bbc62e9c25d4c006cd21d6b1314ccf0ba211382 (patch) | |
tree | 0b1a6d87c3bd250a62235f9df6ed9fffddbbabae /Modules/posixmodule.c | |
parent | 437a0e60baa6eabc2c853bee7ce1543481db8ca7 (diff) | |
download | cpython-3bbc62e9c25d4c006cd21d6b1314ccf0ba211382.zip cpython-3bbc62e9c25d4c006cd21d6b1314ccf0ba211382.tar.gz cpython-3bbc62e9c25d4c006cd21d6b1314ccf0ba211382.tar.bz2 |
Another bulky set of minor changes.
Note addition of gethostbyaddr() and improved repr() for sockets,
renaming of md5.md5() to md5.new(), and fixing of leaks in threads.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index c2678eb..3e3f9cc 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -97,23 +97,22 @@ extern int symlink(); #define MAXPATHLEN 1024 #endif /* MAXPATHLEN */ -/* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */ -#if defined(DIRENT) || defined(_POSIX_VERSION) +#ifdef HAVE_DIRENT_H #include <dirent.h> -#define NLENGTH(dirent) (strlen((dirent)->d_name)) -#else /* not (DIRENT or _POSIX_VERSION) */ +#define NAMLEN(dirent) strlen((dirent)->d_name) +#else #define dirent direct -#define NLENGTH(dirent) ((dirent)->d_namlen) -#ifdef SYSNDIR +#define NAMLEN(dirent) (dirent)->d_namlen +#ifdef HAVE_SYS_NDIR_H #include <sys/ndir.h> -#endif /* SYSNDIR */ -#ifdef SYSDIR +#endif +#ifdef HAVE_SYS_DIR_H #include <sys/dir.h> -#endif /* SYSDIR */ -#ifdef NDIR +#endif +#ifdef HAVE_NDIR_H #include <ndir.h> -#endif /* NDIR */ -#endif /* not (DIRENT or _POSIX_VERSION) */ +#endif +#endif #ifdef NT #include <direct.h> @@ -406,7 +405,7 @@ posix_listdir(self, args) return NULL; } while ((ep = readdir(dirp)) != NULL) { - v = newstringobject(ep->d_name); + v = newsizedstringobject(ep->d_name, NAMLEN(ep)); if (v == NULL) { DECREF(d); d = NULL; |