mirror of
https://github.com/apple/swift-nio
synced 2026-11-26 04:57: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. Motivation: Explain here the context, and why you're making that change. What is the problem you're trying to solve. Modifications: Describe the modifications you've done. Result: After your change, what will change.