MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / eraseEntry

Function eraseEntry

modules/io/storage/flash/storage-flash.c:206–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206static uint8_t eraseEntry(const char *domain, const char *key, uint8_t *buffer)
207{
208 uint32_t entryOffset, valueOffset, entrySize, offset;
209
210 if (!findEntryOffset(domain, key, &entryOffset, &valueOffset, &entrySize, buffer))
211 return 1;
212
213 c_memset(buffer, 0, kBufferSize);
214 offset = entryOffset;
215 while (entrySize) {
216 int use = (entrySize > kBufferSize) ? kBufferSize : entrySize;
217 if (!modSPIWrite(offset, use, buffer))
218 return 0;
219 offset += use;
220 entrySize -= use;
221 }
222
223 return 1;
224}
225
226static uint8_t writeEntry(const char *domain, const char *key, uint8_t format, const uint8_t *value, uint16_t byteCount)
227{

Callers 2

writeEntryFunction · 0.85

Calls 2

findEntryOffsetFunction · 0.85
modSPIWriteFunction · 0.50

Tested by

no test coverage detected