Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1db420d

Browse files
authoredAug 12, 2024··
Update the IrqPool to use a range based for-loop for optimization and safety.
1 parent e15c562 commit 1db420d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
 

‎cores/arduino/Interrupts.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ class IrqPool {
4343
public:
4444
IrqPool() {}
4545
~IrqPool() {
46-
for(int i = 0; i < MAX_IRQ_CHANNEL; i++) {
47-
if(irqs[i] != nullptr){
48-
delete irqs[i];
49-
irqs[i] = nullptr;
50-
}
46+
for (auto& irq : irqs) {
47+
delete irq;
48+
irq = nullptr;
5149
}
52-
}
50+
}
5351
CIrq *get(int index, bool make) {
5452
if(index < MAX_IRQ_CHANNEL) {
5553
if(irqs[index] == nullptr && make) {

0 commit comments

Comments
 (0)
Please sign in to comment.