MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / sdsupdatelen

Function sdsupdatelen

src/util/sds/sds.c:186–189  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

184 * the output will be "6" as the string was modified but the logical length
185 * remains 6 bytes. */
186void sdsupdatelen(sds s) {
187 size_t reallen = strlen(s);
188 sdssetlen(s, reallen);
189}
190
191/* Modify an sds string in-place to make it empty (zero length).
192 * However all the existing buffer is not discarded but set as free space

Callers

nothing calls this directly

Calls 1

sdssetlenFunction · 0.85

Tested by

no test coverage detected