]> git.kaiwu.me - klib.git/commit
Only canonicalise if there is room, and add docs
authorJohn Marshall <jm18@sanger.ac.uk>
Wed, 24 Jul 2013 13:08:25 +0000 (14:08 +0100)
committerJohn Marshall <jm18@sanger.ac.uk>
Wed, 24 Jul 2013 13:08:25 +0000 (14:08 +0100)
commit99ca35977ce22dfd14e63927ce974251b54f5cfb
treeead0716573c47f7b07e76a15f5a1c6bdaa0e4fc8
parente1c00506671062bea47166f4ee77068d8bdb8b12
Only canonicalise if there is room, and add docs

We could increment SIZE to ensure there would be room, but that would
disadvantage people using kstrings for binary data in power-of-2-sized
blocks.  Instead document that SIZE=KS.l+1 will ensure NUL-termination.

This fixes a bug in the previous version when the l<m invariant does not
hold (kputc_()/etc and manual manipulation only maintain the weaker l<=m);
hattip Rob Davies.
kstring.h