diff options
author | David Robillard <d@drobilla.net> | 2021-09-10 13:20:47 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-28 21:57:07 -0500 |
commit | eb804125430e3445e85c423b28e1c41346772ed0 (patch) | |
tree | 532f6995ace537170fbbfde2d0d8226d1a48279b /tools/console.c | |
parent | cbf01be4126cbc0f6d80364a7e0b6ad777a7d8ae (diff) | |
download | serd-eb804125430e3445e85c423b28e1c41346772ed0.tar.gz serd-eb804125430e3445e85c423b28e1c41346772ed0.tar.bz2 serd-eb804125430e3445e85c423b28e1c41346772ed0.zip |
Make environments and sinks part of the world
Although functions/components that require minimal pre-existing state are nice,
these allocate memory and could potentially share resources. So, give them a
pointer to a world which can be used to configure such things. In particular,
this is working towards supporting custom allocators everywhere.
Diffstat (limited to 'tools/console.c')
-rw-r--r-- | tools/console.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/console.c b/tools/console.c index c6e55c17..c2166130 100644 --- a/tools/console.c +++ b/tools/console.c @@ -50,8 +50,8 @@ serd_tool_setup(SerdTool* const tool, // We have something to write to, so build the writing environment if (!(tool->world = serd_world_new()) || - !(tool->env = - serd_create_env(program, options.base_uri, options.out_filename)) || + !(tool->env = serd_create_env( + tool->world, program, options.base_uri, options.out_filename)) || !(tool->writer = serd_writer_new( tool->world, serd_choose_syntax( @@ -291,7 +291,8 @@ serd_parse_common_option(OptionIter* const iter, SerdCommonOptions* const opts) } SerdEnv* -serd_create_env(const char* const program, +serd_create_env(SerdWorld* const world, + const char* const program, const char* const base_string, const char* const out_filename) { @@ -302,10 +303,10 @@ serd_create_env(const char* const program, } if (base_string && serd_uri_string_has_scheme(base_string)) { - return serd_env_new(SERD_STRING(base_string)); + return serd_env_new(world, SERD_STRING(base_string)); } - SerdEnv* const env = serd_env_new(SERD_EMPTY_STRING()); + SerdEnv* const env = serd_env_new(world, SERD_EMPTY_STRING()); serd_set_base_uri_from_path(env, is_rebase ? out_filename : base_string); return env; } |