MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zuiNewSdsFromValue

Function zuiNewSdsFromValue

app/redis-6.2.6/src/t_zset.c:2257–2271  ·  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

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