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) {
578578#endif
579579}
580580
581+ static inline char * _direntName (struct dirent * entry ) {
582+ return entry -> d_name ;
583+ }
584+
581585// major() and minor() might be implemented as macros or functions.
582586static inline unsigned int _dev_major (dev_t rdev ) {
583587#if !TARGET_OS_WASI
Original file line number Diff line number Diff line change @@ -449,10 +449,8 @@ extension FileManager {
449449 errno = 0
450450 while let entry = readdir ( dir) {
451451 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)
456454 if entryName != " . " && entryName != " .. " {
457455 let entryType = Int32 ( entry. pointee. d_type)
458456 try closure ( entryName, entryType)
You can’t perform that action at this time.
0 commit comments