Skip to content

Commit 5234b04

Browse files
committed
Restrict AllocatorESP32 to ESP32
1 parent c19fbd6 commit 5234b04

File tree

1 file changed

+9
-5
lines changed
  • src/AudioTools/CoreAudio/AudioBasic/Collections

1 file changed

+9
-5
lines changed

src/AudioTools/CoreAudio/AudioBasic/Collections/Allocator.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,19 @@ class AllocatorExt : public Allocator {
106106
}
107107
};
108108

109+
110+
#if (defined(ESP32)) && defined(ARDUINO)
111+
109112
/**
110-
* @brief Memory allocateator which forces the allocation in RAM.
113+
* @brief ESP32 Memory allocateator which forces the allocation with the defined
114+
* attirbutes
111115
* @ingroup memorymgmt
112116
* @author Phil Schatzmann
113117
* @copyright GPLv3
114118
*/
115119

116-
class AllocatorESP32 : public Allocator {
117-
AllocatorESP32(int scap = MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL) {
120+
class AllocatorESP32 : public Allocator {
121+
AllocatorESP32(int caps = MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL) {
118122
this->caps = caps;
119123
}
120124
void* do_allocate(size_t size) {
@@ -125,15 +129,15 @@ class AllocatorESP32 : public Allocator {
125129
LOGE("alloc failed for %zu bytes", size);
126130
stop();
127131
}
128-
// initialize object
129-
memset(result, 0, size);
130132
return result;
131133
}
132134

133135
protected:
134136
int caps = 0;
135137
};
136138

139+
#endif
140+
137141
#if (defined(RP2040) || defined(ESP32)) && defined(ARDUINO)
138142

139143
/**

0 commit comments

Comments
 (0)