File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
CoreFoundation/Base.subproj Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -578,6 +578,10 @@ static inline int _direntNameLength(struct dirent *entry) {
578
578
#endif
579
579
}
580
580
581
+ static inline char * _direntName (struct dirent * entry ) {
582
+ return entry -> d_name ;
583
+ }
584
+
581
585
// major() and minor() might be implemented as macros or functions.
582
586
static inline unsigned int _dev_major (dev_t rdev ) {
583
587
#if !TARGET_OS_WASI
Original file line number Diff line number Diff line change @@ -449,10 +449,8 @@ extension FileManager {
449
449
errno = 0
450
450
while let entry = readdir ( dir) {
451
451
let length = Int ( _direntNameLength ( entry) )
452
- let entryName = withUnsafePointer ( to: entry. pointee. d_name) { ( ptr) -> String in
453
- let namePtr = UnsafeRawPointer ( ptr) . assumingMemoryBound ( to: CChar . self)
454
- return string ( withFileSystemRepresentation: namePtr, length: length)
455
- }
452
+ let namePtr = UnsafeRawPointer ( _direntName ( entry) ) . assumingMemoryBound ( to: CChar . self)
453
+ let entryName = string ( withFileSystemRepresentation: namePtr, length: length)
456
454
if entryName != " . " && entryName != " .. " {
457
455
let entryType = Int32 ( entry. pointee. d_type)
458
456
try closure ( entryName, entryType)
You can’t perform that action at this time.
0 commit comments