mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
* Simplify C string to String conversion in IOError.reasonForError Motivation: The standard library already has a String initializer that takes a null-terminated UTF-8 C string. There's no need to construct an UnsafeBufferPointer to use the Collection-based init(decoding:as:). Modifications: Replaced a manual pointer conversion with the appropriate stdlib API. Result: No change. Both version return the same String. The new version is is arguably more correct because it saves the memory-rebinding step. I haven't added new tests because the modified code is covered by SystemTest.testErrorsWorkCorrectly.