Skip to content

Commit b458e8d

Browse files
compnerdCatfish-Man
authored andcommitted
CommandLineSupport: prefer _strdup over strdup
This silences a warning on Windows as `strdup` is considered deprecated in favour of the POSIX compliant `_strdup` spelling.
1 parent b117565 commit b458e8d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stdlib/public/CommandLineSupport/CommandLine.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ char **_swift_stdlib_getUnsafeArgvArgc(int *outArgLen) {
135135
}
136136
}
137137

138+
#if defined(_WIN32)
139+
argv[argc] = _strdup(arg);
140+
#else
138141
argv[argc] = strdup(arg);
142+
#endif
139143
argc += 1;
140144
});
141145

0 commit comments

Comments
 (0)