mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Runtime] Replace use of C++ new with malloc()
This commit is contained in:
@@ -563,14 +563,19 @@ namespace {
|
||||
ConformanceLookupResult result)
|
||||
: Type(key.Type), Witness(result.witnessTable)
|
||||
{
|
||||
if (result.globalActorIsolationType) {
|
||||
ProtoOrStorage = new ExtendedStorage{
|
||||
key.Proto, result.globalActorIsolationType,
|
||||
result.globalActorIsolationWitnessTable
|
||||
};
|
||||
} else {
|
||||
if (!result.globalActorIsolationType) {
|
||||
ProtoOrStorage = key.Proto;
|
||||
return;
|
||||
}
|
||||
|
||||
// Allocate extended storage.
|
||||
void *memory = malloc(sizeof(ExtendedStorage));
|
||||
auto storage = new (memory) ExtendedStorage{
|
||||
key.Proto, result.globalActorIsolationType,
|
||||
result.globalActorIsolationWitnessTable
|
||||
};
|
||||
|
||||
ProtoOrStorage = storage;
|
||||
}
|
||||
|
||||
bool matchesKey(const ConformanceCacheKey &key) const {
|
||||
|
||||
Reference in New Issue
Block a user