From a084dfa02d28a9372a7e406c9b101a43308a4937 Mon Sep 17 00:00:00 2001 From: axtloss Date: Mon, 24 Jun 2024 21:50:48 +0200 Subject: Add new function memvcmp and unit tests --- src/extlib.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/extlib.h') diff --git a/src/extlib.h b/src/extlib.h index 1948352..15903c3 100644 --- a/src/extlib.h +++ b/src/extlib.h @@ -25,7 +25,7 @@ #define malloc(x) error - use malloc_secure /// Automatically zero out a pointer before freeing it -void free_secure (void *__ptr, size_t ptrlen); +void free_secure (void **__ptr, size_t ptrlen); /// Automatically initialise the allocated memory with zeros void *malloc_secure (size_t len); @@ -33,6 +33,10 @@ void *malloc_secure (size_t len); /// Copy the data of one filestream to another void fcopy(FILE *f1, FILE *f2); +/// Compare the first n bytes of a memory area str to the value val. +/// Returns 0 if the values the same, any other value if they are not the same. +int memvcmp (void *str, char val, size_t n); + /// Convert a string to lowercase char *strlwr(char *s); -- cgit v1.2.3