aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-09-10 15:06:42 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit248a874d7425749d29cf900a1c3783c624ea8d8c (patch)
treeaed59f5a484a815cd254506866e98a947858904d /tools
parent0bd10132c6707353dba80bd89cf0102ee7ca4e34 (diff)
downloadserd-248a874d7425749d29cf900a1c3783c624ea8d8c.tar.gz
serd-248a874d7425749d29cf900a1c3783c624ea8d8c.tar.bz2
serd-248a874d7425749d29cf900a1c3783c624ea8d8c.zip
Add support for custom allocators
This makes it explicit in the API where memory is allocated, and allows the user to provide a custom allocator to avoid the use of the default system allocator for whatever reason.
Diffstat (limited to 'tools')
-rw-r--r--tools/console.c4
-rw-r--r--tools/serd-pipe.c17
2 files changed, 11 insertions, 10 deletions
diff --git a/tools/console.c b/tools/console.c
index f7de779f..012c50a3 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -54,10 +54,10 @@ serd_set_base_uri_from_path(SerdEnv* const env, const char* const path)
}
SerdNode* const file_uri =
- serd_new_file_uri(serd_string(input_path), serd_empty_string());
+ serd_new_file_uri(NULL, serd_string(input_path), serd_empty_string());
serd_env_set_base_uri(env, serd_node_string_view(file_uri));
- serd_node_free(file_uri);
+ serd_node_free(NULL, file_uri);
zix_free(NULL, input_path);
return SERD_SUCCESS;
diff --git a/tools/serd-pipe.c b/tools/serd-pipe.c
index 84893506..9be11d66 100644
--- a/tools/serd-pipe.c
+++ b/tools/serd-pipe.c
@@ -163,7 +163,7 @@ main(int argc, char** argv)
return missing_arg(prog, 'B');
}
- base = serd_new_uri(serd_string(argv[a]));
+ base = serd_new_uri(NULL, serd_string(argv[a]));
break;
} else if (opt == 'b') {
if (argv[a][o + 1] || ++a == argc) {
@@ -280,19 +280,20 @@ main(int argc, char** argv)
(output_syntax == SERD_NQUADS || output_syntax == SERD_NTRIPLES)) {
// Choose base URI from the single input path
char* const input_path = zix_canonical_path(NULL, inputs[0]);
- if (!input_path || !(base = serd_new_file_uri(serd_string(input_path),
- serd_empty_string()))) {
+ if (!input_path ||
+ !(base = serd_new_file_uri(
+ NULL, serd_string(input_path), serd_empty_string()))) {
SERDI_ERRORF("unable to determine base URI from path %s\n", inputs[0]);
}
zix_free(NULL, input_path);
}
- SerdWorld* const world = serd_world_new();
+ SerdWorld* const world = serd_world_new(NULL);
const SerdLimits limits = {stack_size, MAX_DEPTH};
serd_world_set_limits(world, limits);
- SerdEnv* const env =
- serd_env_new(base ? serd_node_string_view(base) : serd_empty_string());
+ SerdEnv* const env = serd_env_new(
+ NULL, base ? serd_node_string_view(base) : serd_empty_string());
SerdOutputStream out = serd_open_tool_output(out_filename);
if (!out.stream) {
@@ -370,9 +371,9 @@ main(int argc, char** argv)
free(prefix);
serd_writer_free(writer);
- serd_node_free(input_name);
+ serd_node_free(NULL, input_name);
serd_env_free(env);
- serd_node_free(base);
+ serd_node_free(NULL, base);
serd_world_free(world);
if (serd_close_output(&out)) {