diff options
author | David Robillard <d@drobilla.net> | 2017-07-09 14:59:05 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-07-09 14:59:05 +0200 |
commit | 4d535bbe0390ed4f03c611e433145c9e49cbf3ad (patch) | |
tree | 3ec86327944909c214dabe419ef67c3400fb1aec /serd | |
parent | 4270fbbc761e4d36e9fc28a361b7e8d7c21166d2 (diff) | |
download | serd-4d535bbe0390ed4f03c611e433145c9e49cbf3ad.tar.gz serd-4d535bbe0390ed4f03c611e433145c9e49cbf3ad.tar.bz2 serd-4d535bbe0390ed4f03c611e433145c9e49cbf3ad.zip |
Add serd_node_from_substring()
This allows creating nodes in-place from substrings of other strings to allow
zero-copy serialization from existing delimited buffers.
Diffstat (limited to 'serd')
-rw-r--r-- | serd/serd.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/serd/serd.h b/serd/serd.h index ca72a232..027c4e20 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -449,6 +449,16 @@ SerdNode serd_node_from_string(SerdType type, const uint8_t* str); /** + Make a (shallow) node from a prefix of `str`. + + This measures, but does not copy, `str`. No memory is allocated. + Note that the returned node may not be null terminated. +*/ +SERD_API +SerdNode +serd_node_from_substring(SerdType type, const uint8_t* str, size_t len); + +/** Make a deep copy of `node`. @return a node that the caller must free with serd_node_free(). |