From c2fb23b6b47186e47d983591e47ae4bc153ea4e3 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 22 Mar 2024 11:29:33 -0400 Subject: Remove split_free() function --- include/str.h | 1 - src/str.c | 13 +------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/include/str.h b/include/str.h index 8b8e71c..abb9d9b 100644 --- a/include/str.h +++ b/include/str.h @@ -24,7 +24,6 @@ void strchrdel(char *sptr, const char *chars); long int strchroff(const char *sptr, int ch); void strdelsuffix(char *sptr, const char *suffix); char** split(char *sptr, const char* delim, size_t max); -void split_free(char **ptr); char *join(char **arr, const char *separator); char *join_ex(char *separator, ...); char *substring_between(char *sptr, const char *delims); diff --git a/src/str.c b/src/str.c index 9a4524c..15fbcde 100644 --- a/src/str.c +++ b/src/str.c @@ -172,7 +172,7 @@ void strdelsuffix(char *sptr, const char *suffix) { /** * Split a string by every delimiter in `delim` string. * - * Callee must free memory using `split_free()` + * Callee should free memory using `GENERIC_ARRAY_FREE()` * * @param sptr string to split * @param delim characters to split on @@ -241,17 +241,6 @@ char** split(char *_sptr, const char* delim, size_t max) return result; } -/** - * Frees memory allocated by `split()` - * @param ptr pointer to array - */ -void split_free(char **ptr) { - for (int i = 0; ptr[i] != NULL; i++) { - guard_free(ptr[i]); - } - guard_free(ptr); -} - /** * Create new a string from an array of strings * -- cgit