Re:Simple Dynamic Strings library for C, compatible with nul...
by gravypod on Tuesday December 03, 2019 @09:42AM
(#21692592)
SDS works by allocating a chunk of memory that can fit a header + your string data. The APIs all consume pointers and internally it mutates it's copy of the pointer so it can get at the metadata. So it can be used to generate strings that are passed to other things. I don't think it's easy to use sds operations on other strings in a zero-copy way.
[ Parent
| on HN ]
Re:Simple Dynamic Strings library for C, compatible with nul...
by namibj on Tuesday December 03, 2019 @10:02AM
(#21692793)
Reminds me of libowfat [0]'s stralloc/buffer. It's used in gatling[1], a small (LOC/binary) http/ftp/samba server simple nonblocking IO.
[0]: https://www.fefe.de/libowfat/ [1]: https://www.fefe.de/gatling/