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

Function lpReplaceInteger

src/t_stream.cpp:262–266  ·  view source on GitHub ↗

This is just a wrapper for lpReplace() to directly use a 64 bit integer * instead of a string to replace the current element. The function returns * the new listpack as return value, and also updates the current cursor * by updating '*pos'. */

Source from the content-addressed store, hash-verified

260 * the new listpack as return value, and also updates the current cursor
261 * by updating '*pos'. */
262unsigned char *lpReplaceInteger(unsigned char *lp, unsigned char **pos, int64_t value) {
263 char buf[LONG_STR_SIZE];
264 int slen = ll2string(buf,sizeof(buf),value);
265 return lpInsert(lp, (unsigned char*)buf, slen, *pos, LP_REPLACE, pos);
266}
267
268/* This is a wrapper function for lpGet() to directly get an integer value
269 * from the listpack (that may store numbers as a string), converting

Callers 3

streamAppendItemFunction · 0.85
streamTrimFunction · 0.85

Calls 2

ll2stringFunction · 0.85
lpInsertFunction · 0.85

Tested by

no test coverage detected