blob: 5410bb3a207265cbd9bccec46b6aefc08952eba4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
/*
Copyright 2022 Gabriel Jensen.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <zap/priv.h>
void zap_memgen(void * const _ptr,zap_sz const _sz,zap_sz const _num,void (* const _fn)(zap_sz,void *)) {
unsigned char * ptr = _ptr;
unsigned char * const afterbuf = ptr + _sz * _num;
for (;ptr != afterbuf;ptr += _sz) {_fn((ptr - (unsigned char *)_ptr) / _sz,ptr);}
}
|