diff options
author | David Robillard <d@drobilla.net> | 2021-02-28 14:24:24 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:06 -0500 |
commit | d9ea0564d0954967788b688a224cf81f7892c4a7 (patch) | |
tree | d43e38888e5dd14d0439f76ea57017bf6e954be9 /include/serd/serd.h | |
parent | 8f1192bb2361fcd7907b926e86c41a171ed04ad0 (diff) | |
download | serd-d9ea0564d0954967788b688a224cf81f7892c4a7.tar.gz serd-d9ea0564d0954967788b688a224cf81f7892c4a7.tar.bz2 serd-d9ea0564d0954967788b688a224cf81f7892c4a7.zip |
Make serd_uri_string_length() precise and add it to public API
Diffstat (limited to 'include/serd/serd.h')
-rw-r--r-- | include/serd/serd.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h index dd165360..af087ab5 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -577,6 +577,18 @@ bool serd_uri_is_within(SerdURIView r, SerdURIView base); /** + Return the length of `uri` as a string. + + This can be used to get the expected number of bytes that will be written by + serd_write_uri(). + + @return A string length in bytes, not including the null terminator. +*/ +SERD_API +size_t +serd_uri_string_length(SerdURIView uri); + +/** Write `uri` as a string to `sink`. This will call `sink` several times to emit the serialised URI. @@ -584,7 +596,9 @@ serd_uri_is_within(SerdURIView r, SerdURIView base); @param uri URI to write as a string. @param sink Sink to write string output to. @param stream Opaque user argument to pass to `sink`. - @return The number of bytes written. + + @return The number of bytes written, which is less than + `serd_uri_string_length(uri)` on error. */ SERD_API size_t |