Skip to content

Commit 154af99

Browse files
authored
Merge pull request #103 from compnerd/duplication
TSCBasic: avoid POSIX name on Windows for `strdup`
2 parents 3113a1f + f771a53 commit 154af99

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/TSCBasic/CStringArray.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ public final class CStringArray {
2020

2121
/// Creates an instance from an array of strings.
2222
public init(_ array: [String]) {
23+
#if os(Windows)
24+
cArray = array.map({ $0.withCString({ _strdup($0) }) }) + [nil]
25+
#else
2326
cArray = array.map({ $0.withCString({ strdup($0) }) }) + [nil]
27+
#endif
2428
}
2529

2630
deinit {

0 commit comments

Comments
 (0)