summaryrefslogtreecommitdiff
path: root/zap/source/any/mem/srch.c
diff options
context:
space:
mode:
Diffstat (limited to 'zap/source/any/mem/srch.c')
-rw-r--r--zap/source/any/mem/srch.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/zap/source/any/mem/srch.c b/zap/source/any/mem/srch.c
index 9f86634..46c8ec8 100644
--- a/zap/source/any/mem/srch.c
+++ b/zap/source/any/mem/srch.c
@@ -6,13 +6,12 @@
#include <zap/mem.h>
-void * zap_srch(void const * const _buf,zap_i8 const _val,zap_sz const _num) {
- zap_i8 const * buf;
- zap_i8 * const stop = (zap_i8 *)_buf + _num;
- for (buf = _buf;buf != stop;++buf) {
- if (*buf == _val) {
- return (void *)buf;
- }
+void * zap_srch(void const * const voidbuf,zap_i8 const val,zap_sz const num) {
+ unsigned char const * buf = voidbuf;
+ unsigned char const * const stop = buf + num;
+ while (buf != stop) {
+ unsigned char const * addr = buf++;
+ if (*addr == val) return (void *)addr;
}
return zap_nullptr;
}