/* 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 #include #include void zap_foreach(void * const _ptr,size_t const _sz,size_t const _num,void (* const _fn)(void *)) { unsigned char * pos = _ptr; size_t const numbyte = _sz * _num; unsigned char * const afterbuf = pos + numbyte; for (;pos != afterbuf;pos += _sz) {_fn(pos);} }