blob: 54911e9409b9eb983dcd2e29788c3bfc0449167f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
/*
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>
#include <stddef.h>
void zap_foreach(void * const _ptr,size_t const _sz,size_t const _num,void (* const _fn)(void *)) {
unsigned char * ptr = _ptr;
size_t const numbyte = _sz * _num;
void * const afterbuf = ptr + numbyte;
for (;ptr != afterbuf;ptr += _sz) {_fn(ptr);}
}
|