diff options
author | David Robillard <d@drobilla.net> | 2011-05-06 16:09:58 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-05-06 16:09:58 +0000 |
commit | 246aa2aca72b5580ceae29487c80a2dee567bde2 (patch) | |
tree | 72be9600b8687c8208eeb687cd79c53aaa7e6d88 /src/serdi.c | |
parent | 6bd8d39e12801d21fbf59da2da08602aab9eff32 (diff) | |
download | serd-246aa2aca72b5580ceae29487c80a2dee567bde2.tar.gz serd-246aa2aca72b5580ceae29487c80a2dee567bde2.tar.bz2 serd-246aa2aca72b5580ceae29487c80a2dee567bde2.zip |
Merge SerdEnv and SerdReadState.
git-svn-id: http://svn.drobilla.net/serd/trunk@163 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/serdi.c')
-rw-r--r-- | src/serdi.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/serdi.c b/src/serdi.c index e3d774ef..bc46bd6b 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -22,9 +22,8 @@ #include "serd-config.h" typedef struct { - SerdEnv* env; - SerdReadState* read_state; - SerdWriter* writer; + SerdEnv* env; + SerdWriter* writer; } State; static SerdStatus @@ -32,9 +31,9 @@ event_base(void* handle, const SerdNode* uri_node) { State* const state = (State*)handle; - if (!serd_read_state_set_base_uri(state->read_state, uri_node)) { + if (!serd_env_set_base_uri(state->env, uri_node)) { SerdURI base_uri; - serd_read_state_get_base_uri(state->read_state, &base_uri); + serd_env_get_base_uri(state->env, &base_uri); serd_writer_set_base_uri(state->writer, &base_uri); return SERD_SUCCESS; } @@ -47,7 +46,7 @@ event_prefix(void* handle, const SerdNode* uri_node) { State* const state = (State*)handle; - serd_read_state_set_prefix(state->read_state, name, uri_node); + serd_env_set_prefix(state->env, name, uri_node); serd_writer_set_prefix(state->writer, name, uri_node); return SERD_SUCCESS; } @@ -207,14 +206,14 @@ main(int argc, char** argv) output_style |= SERD_STYLE_ABBREVIATED; } - SerdReadState* read_state = serd_read_state_new(env, base_uri_str); - - serd_read_state_get_base_uri(read_state, &base_uri); + SerdNode base_uri_node = serd_node_from_string(SERD_URI, base_uri_str); + serd_env_set_base_uri(env, &base_uri_node); + serd_env_get_base_uri(env, &base_uri); SerdWriter* writer = serd_writer_new( output_syntax, output_style, env, &base_uri, file_sink, out_fd); - State state = { env, read_state, writer }; + State state = { env, writer }; SerdReader* reader = serd_reader_new( SERD_TURTLE, &state, @@ -232,7 +231,6 @@ main(int argc, char** argv) serd_writer_finish(state.writer); serd_writer_free(state.writer); - serd_read_state_free(state.read_state); serd_env_free(state.env); return (status == SERD_SUCCESS) ? 0 : 1; |