MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / zuiNewSdsFromValue

Function zuiNewSdsFromValue

src/t_zset.cpp:2256–2270  ·  view source on GitHub ↗

This is different from zuiSdsFromValue since returns a new SDS string * which is up to the caller to free. */

Source from the content-addressed store, hash-verified

2254/* This is different from zuiSdsFromValue since returns a new SDS string
2255 * which is up to the caller to free. */
2256sds zuiNewSdsFromValue(zsetopval *val) {
2257 if (val->flags & OPVAL_DIRTY_SDS) {
2258 /* We have already one to return! */
2259 sds ele = val->ele;
2260 val->flags &= ~OPVAL_DIRTY_SDS;
2261 val->ele = NULL;
2262 return ele;
2263 } else if (val->ele) {
2264 return sdsdup(val->ele);
2265 } else if (val->estr) {
2266 return sdsnewlen((char*)val->estr,val->elen);
2267 } else {
2268 return sdsfromlonglong(val->ell);
2269 }
2270}
2271
2272int zuiBufferFromValue(zsetopval *val) {
2273 if (val->estr == NULL) {

Callers 4

zdiffAlgorithm1Function · 0.85
zdiffAlgorithm2Function · 0.85

Calls 3

sdsdupFunction · 0.85
sdsnewlenFunction · 0.85
sdsfromlonglongFunction · 0.85

Tested by

no test coverage detected