logoalt Hacker News

ranger_dangeryesterday at 8:46 PM1 replyview on HN

You might be interested in https://github.com/antirez/sds


Replies

fsckboyyesterday at 10:38 PM

neat, i like it, has some of the same ideas i've used in my string packages

but i did see a place to shave a byte in the sds data struct. The null terminator is a wasted field, that byte (or int) should be used to store the amount of free space left in the buffer (as a proxy for strlen). When there is no space left in the buffer, the free space value will be.... a very convenient 0 heheh

hey, OP said he wants to be a better C programmer!

show 1 reply