mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-01 20:36:38 -05:00
Eliminate obsolete raid_zero API and dedicated zero buffers
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
This commit is contained in:
parent
8f27c393d6
commit
0b64fb2eae
7 changed files with 66 additions and 68 deletions
|
|
@ -43,6 +43,37 @@ void* malloc_nofail_test(size_t size);
|
|||
*/
|
||||
void mtest_vector(int n, size_t size, void** vv);
|
||||
|
||||
/**
|
||||
* Return !=0 if the memory region is completely filled with zeros.
|
||||
*/
|
||||
static inline int mem_is_zero(const void* ptr, size_t size)
|
||||
{
|
||||
const unsigned char* p = ptr;
|
||||
|
||||
while (size != 0 && ((uintptr_t)p % sizeof(size_t)) != 0) {
|
||||
if (*p != 0)
|
||||
return 0;
|
||||
++p;
|
||||
--size;
|
||||
}
|
||||
|
||||
while (size >= sizeof(size_t)) {
|
||||
if (*(const size_t*)p != 0)
|
||||
return 0;
|
||||
p += sizeof(size_t);
|
||||
size -= sizeof(size_t);
|
||||
}
|
||||
|
||||
while (size != 0) {
|
||||
if (*p != 0)
|
||||
return 0;
|
||||
++p;
|
||||
--size;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* crc */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue