diff options
author | David Robillard <d@drobilla.net> | 2023-08-30 20:43:05 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 258ea2ff59bbd2127ea446cf4b9676ad3d7fe53d (patch) | |
tree | d7be35c7b4b3d466049352f2975e2c88c298f4b8 /tools | |
parent | b13ad41a4d65b577b4db67660a9edf3056bdf7af (diff) | |
download | serd-258ea2ff59bbd2127ea446cf4b9676ad3d7fe53d.tar.gz serd-258ea2ff59bbd2127ea446cf4b9676ad3d7fe53d.tar.bz2 serd-258ea2ff59bbd2127ea446cf4b9676ad3d7fe53d.zip |
Use ZixStringView directly
Diffstat (limited to 'tools')
-rw-r--r-- | tools/console.c | 23 | ||||
-rw-r--r-- | tools/console.h | 6 | ||||
-rw-r--r-- | tools/serd-filter.c | 4 | ||||
-rw-r--r-- | tools/serd-pipe.c | 4 |
4 files changed, 19 insertions, 18 deletions
diff --git a/tools/console.c b/tools/console.c index 89223eaf..53e86389 100644 --- a/tools/console.c +++ b/tools/console.c @@ -11,6 +11,7 @@ #include "serd/uri.h" #include "serd/version.h" #include "zix/attributes.h" +#include "zix/string_view.h" #ifdef _WIN32 # ifdef _MSC_VER @@ -223,7 +224,7 @@ serd_choose_syntax(SerdWorld* const world, } SerdStatus -serd_set_input_option(const SerdStringView name, +serd_set_input_option(const ZixStringView name, SerdSyntax* const syntax, SerdReaderFlags* const flags) { @@ -268,7 +269,7 @@ serd_parse_input_argument(OptionIter* const iter, if (!(st = serd_get_argument(iter, &argument))) { if ((st = serd_set_input_option( - serd_string(argument), &options->syntax, &options->flags))) { + zix_string(argument), &options->syntax, &options->flags))) { fprintf(stderr, "%s: unknown option \"%s\"\n", iter->argv[0], argument); } else if (!strcmp(argument, "empty") || options->syntax) { options->overridden = true; @@ -279,7 +280,7 @@ serd_parse_input_argument(OptionIter* const iter, } SerdStatus -serd_set_output_option(const SerdStringView name, +serd_set_output_option(const ZixStringView name, SerdSyntax* const syntax, SerdWriterFlags* const flags) { @@ -325,7 +326,7 @@ serd_parse_output_argument(OptionIter* const iter, if (!(st = serd_get_argument(iter, &argument))) { if ((st = serd_set_output_option( - serd_string(argument), &options->syntax, &options->flags))) { + zix_string(argument), &options->syntax, &options->flags))) { fprintf(stderr, "%s: unknown option \"%s\"\n", iter->argv[0], argument); } else if (!strcmp(argument, "empty") || options->syntax) { options->overridden = true; @@ -397,7 +398,7 @@ serd_create_env(SerdAllocator* const allocator, const char* const out_filename) { if (serd_uri_string_has_scheme(base_string)) { - return serd_env_new(allocator, serd_string(base_string)); + return serd_env_new(allocator, zix_string(base_string)); } const bool is_rebase = !strcmp(base_string, "rebase"); @@ -407,14 +408,14 @@ serd_create_env(SerdAllocator* const allocator, return NULL; } - SerdEnv* const env = serd_env_new(allocator, serd_empty_string()); - serd_env_set_base_path(env, serd_string(out_filename)); + SerdEnv* const env = serd_env_new(allocator, zix_empty_string()); + serd_env_set_base_path(env, zix_string(out_filename)); return env; } - SerdEnv* const env = serd_env_new(allocator, serd_empty_string()); - const SerdStringView base = serd_string(base_string); - const SerdStatus st = serd_env_set_base_path(env, base); + SerdEnv* const env = serd_env_new(allocator, zix_empty_string()); + const ZixStringView base = zix_string(base_string); + const SerdStatus st = serd_env_set_base_path(env, base); if (st) { fprintf(stderr, "%s: invalid base URI \"%s\"\n", program, base_string); serd_env_free(env); @@ -506,7 +507,7 @@ serd_read_inputs(SerdWorld* const world, // Use the filename as the base URI if possible if user didn't override it const char* const in_path = inputs[i]; if (!opts.base_uri[0] && !!strcmp(in_path, "-")) { - serd_env_set_base_path(env, serd_string(in_path)); + serd_env_set_base_path(env, zix_string(in_path)); } // Open the input stream diff --git a/tools/console.h b/tools/console.h index ed59264a..7e59862d 100644 --- a/tools/console.h +++ b/tools/console.h @@ -12,10 +12,10 @@ #include "serd/reader.h" #include "serd/sink.h" #include "serd/status.h" -#include "serd/string_view.h" #include "serd/syntax.h" #include "serd/world.h" #include "serd/writer.h" +#include "zix/string_view.h" #include <stdbool.h> #include <stdint.h> @@ -89,7 +89,7 @@ SerdStatus serd_get_size_argument(OptionIter* iter, size_t* argument); SerdStatus -serd_set_input_option(SerdStringView name, +serd_set_input_option(ZixStringView name, SerdSyntax* syntax, SerdReaderFlags* flags); @@ -97,7 +97,7 @@ SerdStatus serd_parse_input_argument(OptionIter* iter, SerdSyntaxOptions* options); SerdStatus -serd_set_output_option(SerdStringView name, +serd_set_output_option(ZixStringView name, SerdSyntax* syntax, SerdWriterFlags* flags); diff --git a/tools/serd-filter.c b/tools/serd-filter.c index 53424e62..464a727e 100644 --- a/tools/serd-filter.c +++ b/tools/serd-filter.c @@ -16,10 +16,10 @@ #include "serd/sink.h" #include "serd/statement.h" #include "serd/status.h" -#include "serd/string_view.h" #include "serd/syntax.h" #include "serd/world.h" #include "serd/writer.h" +#include "zix/string_view.h" #include <stdarg.h> #include <stdbool.h> @@ -84,7 +84,7 @@ parse_pattern(SerdWorld* const world, const bool inclusive) { SerdAllocator* const allocator = serd_world_allocator(world); - SerdEnv* const env = serd_env_new(allocator, serd_empty_string()); + SerdEnv* const env = serd_env_new(allocator, zix_empty_string()); PatternEventContext ctx = {allocator, {NULL, NULL, NULL, NULL}}; SerdSink* in_sink = serd_sink_new(allocator, &ctx, on_pattern_event, NULL); diff --git a/tools/serd-pipe.c b/tools/serd-pipe.c index 569119fb..06c8e55e 100644 --- a/tools/serd-pipe.c +++ b/tools/serd-pipe.c @@ -9,9 +9,9 @@ #include "serd/reader.h" #include "serd/sink.h" #include "serd/status.h" -#include "serd/string_view.h" #include "serd/syntax.h" #include "serd/writer.h" +#include "zix/string_view.h" #include <stdbool.h> #include <stdint.h> @@ -48,7 +48,7 @@ run(const Options opts) serd_set_log_func(app.world, serd_quiet_log_func, NULL); } - serd_writer_set_root_uri(app.writer, serd_string(opts.root_uri)); + serd_writer_set_root_uri(app.writer, zix_string(opts.root_uri)); // Set up the output pipeline: [canon] -> writer const SerdSink* const target = serd_writer_sink(app.writer); |