mirror of
https://github.com/esphome/esphome.git
synced 2025-10-05 11:23:47 +01:00
cleanup
This commit is contained in:
@@ -203,6 +203,7 @@ class BLEEvent {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
// We only handle 4 GAP event types, others are dropped
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,14 +42,17 @@ template<uint8_t SIZE> class BLEEventPool {
|
|||||||
RAMAllocator<BLEEvent> allocator(RAMAllocator<BLEEvent>::ALLOC_INTERNAL);
|
RAMAllocator<BLEEvent> allocator(RAMAllocator<BLEEvent>::ALLOC_INTERNAL);
|
||||||
event = allocator.allocate(1);
|
event = allocator.allocate(1);
|
||||||
|
|
||||||
if (event != nullptr) {
|
if (event == nullptr) {
|
||||||
// Placement new to construct the object
|
// Memory allocation failed
|
||||||
new (event) BLEEvent();
|
return nullptr;
|
||||||
this->total_created_++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Placement new to construct the object
|
||||||
|
new (event) BLEEvent();
|
||||||
|
this->total_created_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return event; // Will be nullptr if allocation failed
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return an event to the pool
|
// Return an event to the pool
|
||||||
|
Reference in New Issue
Block a user