aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--serd/serd.h15
-rw-r--r--src/reader.c2
-rw-r--r--src/string.c6
-rw-r--r--tests/serd_test.c10
-rw-r--r--wscript2
6 files changed, 29 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index a6ecf2b4..d26ae983 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-serd (0.29.3) unstable;
+serd (0.29.4) unstable;
* Fix length of base64 encoded nodes
* Clarify errors returned by serd_env_expand()
@@ -15,8 +15,9 @@ serd (0.29.3) unstable;
* Add NTriples test suite
* Fix building with MSVC
* Clean up testing code
+ * Add serd_free for freeing memory allocated by serd
- -- David Robillard <d@drobilla.net> Sat, 14 Jul 2018 10:26:05 +0200
+ -- David Robillard <d@drobilla.net> Sat, 21 Jul 2018 17:23:43 +0200
serd (0.28.0) stable;
diff --git a/serd/serd.h b/serd/serd.h
index f3d83515..49a516fa 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -275,6 +275,17 @@ typedef enum {
} 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*
diff --git a/src/reader.c b/src/reader.c
index c9b00f66..f37eac14 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -264,7 +264,7 @@ serd_reader_read_file(SerdReader* reader,
FILE* fd = serd_fopen((const char*)path, "rb");
if (!fd) {
- free(path);
+ serd_free(path);
return SERD_ERR_UNKNOWN;
}
diff --git a/src/string.c b/src/string.c
index d49e1e68..2f79f496 100644
--- a/src/string.c
+++ b/src/string.c
@@ -18,6 +18,12 @@
#include <math.h>
+void
+serd_free(void* ptr)
+{
+ free(ptr);
+}
+
const uint8_t*
serd_strerror(SerdStatus status)
{
diff --git a/tests/serd_test.c b/tests/serd_test.c
index 3c2fb630..af158215 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -106,8 +106,8 @@ check_file_uri(const char* hostname,
path, node.buf, out_path);
}
- free(out_path);
- free(out_hostname);
+ serd_free(out_path);
+ serd_free(out_hostname);
serd_node_free(&node);
return ret;
}
@@ -225,7 +225,7 @@ main(void)
}
serd_node_free(&blob);
- free(out);
+ serd_free(out);
free(data);
}
@@ -325,7 +325,7 @@ main(void)
if (strcmp((const char*)out_path, "/foo/bar")) {
FAILF("bad tolerance of junk escape: `%s'\n", out_path);
}
- free(out_path);
+ serd_free(out_path);
// Test serd_node_equals
@@ -618,7 +618,7 @@ main(void)
FAILF("Incorrect chunk output:\n%s\n", chunk.buf);
}
- free(out);
+ serd_free(out);
// Rewind and test reader
fseek(fd, 0, SEEK_SET);
diff --git a/wscript b/wscript
index 048ebce9..fb9a31e5 100644
--- a/wscript
+++ b/wscript
@@ -10,7 +10,7 @@ import waflib.extras.autowaf as autowaf
# major increment <=> incompatible changes
# minor increment <=> compatible changes (additions)
# micro increment <=> no interface changes
-SERD_VERSION = '0.29.2'
+SERD_VERSION = '0.29.4'
SERD_MAJOR_VERSION = '0'
# Mandatory waf variables