Author: Armin Rigo <ar...@tunes.org> Branch: cpy-extension Changeset: r329:9d652c06f394 Date: 2012-06-14 12:57 +0200 http://bitbucket.org/cffi/cffi/changeset/9d652c06f394/
Log: Replace this hard-coded "4" with the #define. diff --git a/demo/readdir2.py b/demo/readdir2.py --- a/demo/readdir2.py +++ b/demo/readdir2.py @@ -19,11 +19,16 @@ DIR *fdopendir(int fd); int closedir(DIR *dirp); + static const int DT_DIR; + """) ffi.C = ffi.verify(""" #ifndef _ATFILE_SOURCE # define _ATFILE_SOURCE #endif +#ifndef _BSD_SOURCE +# define _BSD_SOURCE +#endif #include <fcntl.h> #include <sys/types.h> #include <dirent.h> @@ -47,7 +52,7 @@ break name = str(dirent.d_name) print '%3d %s' % (dirent.d_type, name) - if dirent.d_type == 4 and name != '.' and name != '..': + if dirent.d_type == ffi.C.DT_DIR and name != '.' and name != '..': walk(dirfd, name) ffi.C.closedir(dir) print '}' _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit