This is different from zuiSdsFromValue since returns a new SDS string * which is up to the caller to free. */
| 2254 | /* This is different from zuiSdsFromValue since returns a new SDS string |
| 2255 | * which is up to the caller to free. */ |
| 2256 | sds 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 | |
| 2272 | int zuiBufferFromValue(zsetopval *val) { |
| 2273 | if (val->estr == NULL) { |
no test coverage detected