Commit Graph

17 Commits

Author SHA1 Message Date
Bryan O'Sullivan
6a52ab5621 osutil: use fdopendir instead of dirfd 2007-10-15 12:57:01 -07:00
Matt Mackall
6983b23f64 osutil: improve portability
- manually inline mode_to_kind
- remove unused alloca include
- remove fstatat and associated bits

It's not obvious that there's an advantage to using fstatat in terms
of performance. The race-avoidance properties of fstatat aren't
terribly useful to us either. So best to avoid it until we figure out
how to use it portably.
2007-10-11 17:46:06 -05:00
Bryan O'Sullivan
69513180ef osutil: Solaris build fix 2007-10-09 08:39:37 -07:00
Bryan O'Sullivan
f32d9d204f Fix build error with Sun C compiler. 2007-10-08 22:45:48 -07:00
Alexis S. L. Carvalho
a6ace30eb5 osutil.c: use strncpy instead of strncat 2007-10-08 21:37:25 -03:00
Matt Mackall
1a6c764cc5 osutil: more tidying
- do_stat -> keep_stat
- all_kinds -> !need_stat
- simplify main error logic
- reorder declarations
2007-10-08 18:47:21 -05:00
Matt Mackall
fb0cad4f74 osutil: move file list loop to its own function 2007-10-08 18:47:18 -05:00
Matt Mackall
cc38448e9d osutil: simplify DT_REG support 2007-10-08 18:47:17 -05:00
Matt Mackall
dafe26ed0b osutils: pull file stat loop into its own function 2007-10-08 18:47:16 -05:00
Matt Mackall
20936fe972 osutil: fold stat paths together
- simplify st/py_st logic
- use stp to point to stat buffer
- combine stat paths
2007-10-08 18:47:15 -05:00
Matt Mackall
65e8ee71fa osutil: more cleanups
- eliminate a level of nesting
- untab targets of gotos
2007-10-08 18:47:14 -05:00
Matt Mackall
50cce1cc95 osutil: eliminate alloca call
- make full_path a PATH_MAX + epsilon local buffer
- use strncpy and strncat
2007-10-08 18:47:12 -05:00
Matt Mackall
638a3ac761 osutil: cleanups
- use tabs
- eliminate old-style function pointer calls
- eliminate weird scoping
- eliminate assignment-in-iff
- use !foo rather than foo == NULL
2007-10-08 18:47:06 -05:00
Giorgos Keramidas
a1efeccfd8 osutil.c: style fix - delete trailing end-of-line spaces 2007-10-07 21:56:36 +03:00
Alexis S. L. Carvalho
f77b38c731 osutil.c: use readdir instead of readdir64
Some systems (e.g. *BSD) don't have a readdir64 function - the regular
readdir already uses 64-bit types.

On other systems (Linux, Solaris, ...), if Python was compiled with large
file support, Python.h will define _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64,
so that any call to readdir will actually be a call to readdir64.  If Python
was not compiled with large file support, we probably don't want to define
these macros to avoid ABI problems.
2007-10-06 14:14:11 -03:00
Alexis S. L. Carvalho
f65110708a osutil.c: include Python.h before the other headers
This is recommended by the Python documentation, since Python.h defines
some constants.
2007-10-06 14:14:11 -03:00
Bryan O'Sullivan
e317f81ab3 Add osutil module, containing a listdir function.
This is similar to os.listdir, only it returns a sorted list of tuples.
2007-10-05 15:01:06 -07:00