From 1c5a6894579924cb4d35e41ba3f140797a89c083 Mon Sep 17 00:00:00 2001 From: default Date: Tue, 11 Jul 2023 19:45:58 +0200 Subject: Fixed some memory leaks. --- xs.h | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'xs.h') diff --git a/xs.h b/xs.h index 6bf3eb8..ad8a35d 100644 --- a/xs.h +++ b/xs.h @@ -72,7 +72,6 @@ xs_str *xs_replace_in(xs_str *str, const char *sfrom, const char *sto, int times xs_str *xs_fmt(const char *fmt, ...); int xs_str_in(const char *haystack, const char *needle); int _xs_startsorends(const char *str, const char *xfix, int ends); -xs_str *xs_encode_html(const xs_str *str); #define xs_startswith(str, prefix) _xs_startsorends(str, prefix, 0) #define xs_endswith(str, postfix) _xs_startsorends(str, postfix, 1) xs_str *xs_crop_i(xs_str *str, int start, int end); @@ -507,20 +506,6 @@ int _xs_startsorends(const char *str, const char *xfix, int ends) return !!(ssz >= psz && memcmp(xfix, str + (ends ? ssz - psz : 0), psz) == 0); } -xs_str *xs_encode_html(const char *str) -/* escapes html characters */ -{ - xs_str *encoded = xs_replace(str, "&", "&"); - encoded = xs_replace(encoded, "<", "<"); - encoded = xs_replace(encoded, ">", ">"); - encoded = xs_replace(encoded, "\"", """); - encoded = xs_replace(encoded, "'", "'"); - - // Restore only
. Probably safe. Let's hope nothing goes wrong with this. - encoded = xs_replace(encoded, "<br>", "
"); - - return encoded; -} xs_str *xs_crop_i(xs_str *str, int start, int end) /* crops the d_char to be only from start to end */ -- cgit