aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-23 02:43:36 +0000
committerDavid Robillard <d@drobilla.net>2011-12-23 02:43:36 +0000
commit4b512a68903953e1372c3ad3b982eed72a7db681 (patch)
treef6bb25c6519ca165cbb9ab55d51cf37763eff61c /src
parente9cdaa1d2fe82818c1488fa66fbf65152a7ebd56 (diff)
downloadserd-4b512a68903953e1372c3ad3b982eed72a7db681.tar.gz
serd-4b512a68903953e1372c3ad3b982eed72a7db681.tar.bz2
serd-4b512a68903953e1372c3ad3b982eed72a7db681.zip
Add serd_file_sink for the common case of writing to a FILE* stream.
git-svn-id: http://svn.drobilla.net/serd/trunk@262 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src')
-rw-r--r--src/serdi.c9
-rw-r--r--src/writer.c9
2 files changed, 10 insertions, 8 deletions
diff --git a/src/serdi.c b/src/serdi.c
index 14fe3275..7a3ef301 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -56,13 +56,6 @@ print_usage(const char* name, bool error)
return error ? 1 : 0;
}
-static size_t
-file_sink(const void* buf, size_t len, void* stream)
-{
- FILE* file = (FILE*)stream;
- return fwrite(buf, 1, len, file);
-}
-
bool
set_syntax(SerdSyntax* syntax, const char* name)
{
@@ -202,7 +195,7 @@ main(int argc, char** argv)
}
SerdWriter* writer = serd_writer_new(
- output_syntax, output_style, env, &base_uri, file_sink, out_fd);
+ output_syntax, output_style, env, &base_uri, serd_file_sink, out_fd);
if (chop_prefix) {
serd_writer_chop_blank_prefix(writer, chop_prefix);
diff --git a/src/writer.c b/src/writer.c
index cee0455f..b9d80ce7 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -606,3 +606,12 @@ serd_writer_free(SerdWriter* writer)
}
free(writer);
}
+
+SERD_API
+size_t
+serd_file_sink(const void* buf, size_t len, void* stream)
+{
+ FILE* file = (FILE*)stream;
+ return fwrite(buf, 1, len, file);
+}
+