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
| 182 | * the output will be "6" as the string was modified but the logical length |
| 183 | * remains 6 bytes. */ |
| 184 | void sdsupdatelen(sds s) { |
| 185 | size_t reallen = strlen(s); |
| 186 | sdssetlen(s, reallen); |
| 187 | } |
| 188 | |
| 189 | /* Modify an sds string in-place to make it empty (zero length). |
| 190 | * However all the existing buffer is not discarded but set as free space |
nothing calls this directly
no test coverage detected