diff options
author | David Robillard <d@drobilla.net> | 2018-06-19 09:39:48 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:58 +0100 |
commit | 14f1d39b4180475a5fa9030fccf95fdc8b693c09 (patch) | |
tree | b48575740b19b1477a71cbda8be920dddd507328 | |
parent | 73a031cb9bf871eb515da436bc4c1228891e2457 (diff) | |
download | serd-14f1d39b4180475a5fa9030fccf95fdc8b693c09.tar.gz serd-14f1d39b4180475a5fa9030fccf95fdc8b693c09.tar.bz2 serd-14f1d39b4180475a5fa9030fccf95fdc8b693c09.zip |
Separate style enum from style flags types
-rw-r--r-- | serd/serd.h | 7 | ||||
-rw-r--r-- | src/serdi.c | 4 | ||||
-rw-r--r-- | src/writer.c | 40 | ||||
-rw-r--r-- | tests/serd_test.c | 4 |
4 files changed, 30 insertions, 25 deletions
diff --git a/serd/serd.h b/serd/serd.h index 136d72f2..6e68e349 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -307,6 +307,11 @@ typedef enum { } SerdStyle; /** + Bitwise OR of SerdStyle values. +*/ +typedef uint32_t SerdStyleFlags; + +/** Free memory allocated by Serd. This function exists because some systems require memory allocated by a @@ -1203,7 +1208,7 @@ SERD_API SerdWriter* serd_writer_new(SerdWorld* world, SerdSyntax syntax, - SerdStyle style, + SerdStyleFlags style, SerdEnv* env, SerdWriteFunc ssink, void* stream); diff --git a/src/serdi.c b/src/serdi.c index fc3efc04..8939ae3b 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -205,7 +205,7 @@ main(int argc, char** argv) SerdWorld* world = serd_world_new(); SerdEnv* env = serd_env_new(base); - int output_style = 0; + SerdStyleFlags output_style = 0; if (output_syntax == SERD_NTRIPLES || ascii) { output_style |= SERD_STYLE_ASCII; } else if (output_syntax == SERD_TURTLE) { @@ -227,7 +227,7 @@ main(int argc, char** argv) SerdWriter* writer = serd_writer_new(world, output_syntax, - (SerdStyle)output_style, + output_style, env, (SerdWriteFunc)fwrite, out_fd); diff --git a/src/writer.c b/src/writer.c index 4b5b1245..1868b106 100644 --- a/src/writer.c +++ b/src/writer.c @@ -87,25 +87,25 @@ static const SepRule rules[] = { }; struct SerdWriterImpl { - SerdWorld* world; - SerdSink iface; - SerdSyntax syntax; - SerdStyle style; - SerdEnv* env; - SerdNode* root_node; - SerdURI root_uri; - SerdStack anon_stack; - SerdByteSink byte_sink; - SerdErrorSink error_sink; - void* error_handle; - WriteContext context; - SerdNode* list_subj; - unsigned list_depth; - unsigned indent; - char* bprefix; - size_t bprefix_len; - Sep last_sep; - bool empty; + SerdWorld* world; + SerdSink iface; + SerdSyntax syntax; + SerdStyleFlags style; + SerdEnv* env; + SerdNode* root_node; + SerdURI root_uri; + SerdStack anon_stack; + SerdByteSink byte_sink; + SerdErrorSink error_sink; + void* error_handle; + WriteContext context; + SerdNode* list_subj; + unsigned list_depth; + unsigned indent; + char* bprefix; + size_t bprefix_len; + Sep last_sep; + bool empty; }; typedef enum { @@ -867,7 +867,7 @@ serd_writer_finish(SerdWriter* writer) SerdWriter* serd_writer_new(SerdWorld* world, SerdSyntax syntax, - SerdStyle style, + SerdStyleFlags style, SerdEnv* env, SerdWriteFunc ssink, void* stream) diff --git a/tests/serd_test.c b/tests/serd_test.c index 515b0579..cafd9653 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -596,7 +596,7 @@ test_writer(const char* const path) SerdWriter* writer = serd_writer_new(world, SERD_TURTLE, - (SerdStyle)0, + 0, env, (SerdWriteFunc)fwrite, fd); @@ -677,7 +677,7 @@ test_writer(const char* const path) // Test buffer sink SerdBuffer buffer = { NULL, 0 }; writer = serd_writer_new( - world, SERD_TURTLE, (SerdStyle)0, env, serd_buffer_sink, &buffer); + world, SERD_TURTLE, 0, env, serd_buffer_sink, &buffer); o = serd_new_uri("http://example.org/base"); assert(!serd_writer_set_base_uri(writer, o)); |