From 2fddc28b430ede69e44dcd69e3692993a7c1d161 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 6 Jan 2018 16:05:42 -0500 Subject: Add serd_free for freeing memory allocated by serd --- serd/serd.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'serd') diff --git a/serd/serd.h b/serd/serd.h index f3d83515..49a516fa 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -274,6 +274,17 @@ typedef enum { SERD_STYLE_BULK = 1 << 4 /**< Write output in pages. */ } SerdStyle; +/** + Free memory allocated by Serd. + + This function exists because some systems require memory allocated by a + library to be freed by code in the same library. It is otherwise equivalent + to the standard C free() function. +*/ +SERD_API +void +serd_free(void* ptr); + /** @name String Utilities @{ @@ -316,7 +327,7 @@ serd_strtod(const char* str, char** endptr); @param str Base64 string to decode. @param len The length of `str`. @param size Set to the size of the returned blob in bytes. - @return A newly allocated blob which must be freed with free(). + @return A newly allocated blob which must be freed with serd_free(). */ SERD_API void* @@ -386,7 +397,7 @@ serd_uri_to_path(const uint8_t* uri); @param hostname If non-NULL, set to the hostname, if present. @return The path component of the URI. - The returned path and `*hostname` must be freed with free(). + The returned path and `*hostname` must be freed with serd_free(). */ SERD_API uint8_t* -- cgit v1.2.1