We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 204829e + 15b8772 commit dfd805fCopy full SHA for dfd805f
tools/swift-stdlib-tool/swift-stdlib-tool.mm
@@ -80,6 +80,7 @@
80
#include <libkern/OSByteOrder.h>
81
82
#include <algorithm>
83
+#include <vector>
84
using namespace std;
85
86
#include <Foundation/Foundation.h>
@@ -672,9 +673,10 @@ -(NSString *)sst_command {
672
673
NSString *self_executable = []() -> NSString * {
674
uint32_t len = 0;
675
_NSGetExecutablePath(nil, &len);
- char buf[len];
676
- _NSGetExecutablePath(buf, &len);
677
- return [[NSString alloc] initWithUTF8String:buf];
+ std::vector<char> buffer;
+ buffer.reserve(len);
678
+ _NSGetExecutablePath(buffer.data(), &len);
679
+ return [[NSString alloc] initWithUTF8String:buffer.data()];
680
}();
681
682
0 commit comments