Set the sds string length to the length as obtained with strlen(), so * considering as content only up to the first null term character. * * This function is useful when the sds string is hacked manually in some * way, like in the following example: * * s = sdsnew("foobar"); * s[2] = '\0'; * sdsupdatelen(s); * printf("%d\n", sdslen(s)); * * The output will be "2", but if we comment out
| 211 | * the output will be "6" as the string was modified but the logical length |
| 212 | * remains 6 bytes. */ |
| 213 | void sdsupdatelen(sds s) { |
| 214 | size_t reallen = strlen(s); |
| 215 | sdssetlen(s, reallen); |
| 216 | } |
| 217 | |
| 218 | /* Modify an sds string in-place to make it empty (zero length). |
| 219 | * However all the existing buffer is not discarded but set as free space |
nothing calls this directly
no test coverage detected