summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-08-14 00:57:09 +0000
committerDavid Robillard <d@drobilla.net>2015-08-14 00:57:09 +0000
commitd3fff833545e4c912e8c5517818f9f6f225c0df8 (patch)
treebfad57841cf817a02a8c6bcdbdc2363c3357d753
parent8468b9a199358d76c2e4d1a0ef836373d5fc08cd (diff)
downloadlilv-d3fff833545e4c912e8c5517818f9f6f225c0df8.tar.gz
lilv-d3fff833545e4c912e8c5517818f9f6f225c0df8.tar.bz2
lilv-d3fff833545e4c912e8c5517818f9f6f225c0df8.zip
Add lilv_free() for systems picky about such things.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5706 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--NEWS5
-rw-r--r--lilv/lilv.h16
-rw-r--r--src/util.c6
-rw-r--r--test/lilv_test.c10
-rw-r--r--wscript2
5 files changed, 28 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index 2b05a30..12da771 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-lilv (0.21.3) unstable;
+lilv (0.21.5) unstable;
* Fix loading files with spaces in their path
* Add lilv_file_uri_parse() for correct URI to path conversion
@@ -6,6 +6,7 @@ lilv (0.21.3) unstable;
* Add lilv_state_emit_port_values() for special port value handling
* Add lilv_state_get_uri()
* Add lilv_state_delete() for deleting user saved presets
+ * Add lilv_free() for systems picky about such things
* Fix lilv_world_ask() to work with wildcards
* Fix creation of duplicate manifest entries when saving state
* Fix bindings for Python 3
@@ -20,7 +21,7 @@ lilv (0.21.3) unstable;
* Windows fixes (thanks John Emmas)
* Minor documentation improvements
- -- David Robillard <d@drobilla.net> Thu, 13 Aug 2015 19:55:27 -0400
+ -- David Robillard <d@drobilla.net> Thu, 13 Aug 2015 20:30:04 -0400
lilv (0.20.0) stable;
diff --git a/lilv/lilv.h b/lilv/lilv.h
index e907789..27ed6d0 100644
--- a/lilv/lilv.h
+++ b/lilv/lilv.h
@@ -101,6 +101,16 @@ typedef void LilvNodes; /**< set<Node>. */
*/
/**
+ Free memory allocated by Lilv.
+
+ 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.
+*/
+LILV_API void
+lilv_free(void* ptr);
+
+/**
@name Node
@{
*/
@@ -119,7 +129,7 @@ lilv_uri_to_path(const char* uri);
/**
Convert a file URI string to a local path string.
For example, "file://foo/bar%20one/baz.ttl" returns "/foo/bar one/baz.ttl".
- Return value must be freed by caller.
+ Return value must be freed by caller with lilv_free().
@param uri The file URI to parse.
@param hostname If non-NULL, set to the hostname in the URI, if any.
@return `uri` converted to a path, or NULL on failure (URI is not local).
@@ -196,7 +206,7 @@ lilv_node_equals(const LilvNode* value, const LilvNode* other);
/**
Return this value as a Turtle/SPARQL token.
- Returned value must be freed by caller with free().
+ Returned value must be freed by caller with lilv_free().
<table>
<caption>Example Turtle Tokens</caption>
<tr><th>URI</th><td>&lt;http://example.org/foo &gt;</td></tr>
@@ -261,7 +271,7 @@ lilv_node_as_string(const LilvNode* value);
/**
Return the path of a file URI node.
Returns NULL if `value` is not a file URI.
- Returned value must be freed by caller.
+ Returned value must be freed by caller with lilv_free().
*/
LILV_API char*
lilv_node_get_path(const LilvNode* value, char** hostname);
diff --git a/src/util.c b/src/util.c
index 029cb92..c072514 100644
--- a/src/util.c
+++ b/src/util.c
@@ -65,6 +65,12 @@ CreateSymbolicLink(LPCTSTR linkpath, LPCTSTR targetpath, DWORD flags)
# define PAGE_SIZE 4096
#endif
+void
+lilv_free(void* ptr)
+{
+ free(ptr);
+}
+
char*
lilv_strjoin(const char* first, ...)
{
diff --git a/test/lilv_test.c b/test/lilv_test.c
index c40dc76..e89239c 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -269,16 +269,16 @@ test_value(void)
char* tok = lilv_node_get_turtle_token(uval);
TEST_ASSERT(!strcmp(tok, "<http://example.org>"));
- free(tok);
+ lilv_free(tok);
tok = lilv_node_get_turtle_token(sval);
TEST_ASSERT(!strcmp(tok, "Foo"));
- free(tok);
+ lilv_free(tok);
tok = lilv_node_get_turtle_token(ival);
TEST_ASSERT(!strcmp(tok, "42"));
- free(tok);
+ lilv_free(tok);
tok = lilv_node_get_turtle_token(fval);
TEST_ASSERT(!strncmp(tok, "1.6180", 6));
- free(tok);
+ lilv_free(tok);
LilvNode* uval_e = lilv_new_uri(world, "http://example.org");
LilvNode* sval_e = lilv_new_string(world, "Foo");
@@ -701,7 +701,7 @@ test_plugin(void)
char* blank_tok = lilv_node_get_turtle_token(blank);
TEST_ASSERT(!strncmp(blank_tok, "_:", 2));
TEST_ASSERT(!strcmp(blank_tok + 2, blank_str));
- free(blank_tok);
+ lilv_free(blank_tok);
lilv_node_free(blank_p);
lilv_nodes_free(blanks);
diff --git a/wscript b/wscript
index 493f1cc..1dcd69c 100644
--- a/wscript
+++ b/wscript
@@ -12,7 +12,7 @@ import waflib.Logs as Logs
# major increment <=> incompatible changes
# minor increment <=> compatible changes (additions)
# micro increment <=> no interface changes
-LILV_VERSION = '0.21.3'
+LILV_VERSION = '0.21.5'
LILV_MAJOR_VERSION = '0'
# Mandatory waf variables