antirez / sds

Simple Dynamic Strings library for C
BSD 2-Clause "Simplified" License
4.89k stars 473 forks source link

Error in example #105

Open emilfihlman opened 5 years ago

emilfihlman commented 5 years ago

In the example:

sds s1 = sdsnew("abcd"); sds s2 = sdsempty(); s[1] = 1; s[2] = 2; s[3] = '\n'; s2 = sdscatrepr(s2,s1,sdslen(s1)); printf("%s\n", s2);

output> "a\x01\x02\n"

We are editing indices of s but that is not declared, s should be s1.

slothlockneo commented 5 years ago

See pull request #108 for a fix.