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

Function streamIteratorGetField

app/redis-6.2.6/src/t_stream.c:1238–1248  ·  view source on GitHub ↗

Get the field and value of the current item we are iterating. This should * be called immediately after streamIteratorGetID(), and for each field * according to the number of fields returned by streamIteratorGetID(). * The function populates the field and value pointers and the corresponding * lengths by reference, that are valid until the next iterator call, assuming * no one touches the str

Source from the content-addressed store, hash-verified

1236 * lengths by reference, that are valid until the next iterator call, assuming
1237 * no one touches the stream meanwhile. */
1238void streamIteratorGetField(streamIterator *si, unsigned char **fieldptr, unsigned char **valueptr, int64_t *fieldlen, int64_t *valuelen) {
1239 if (si->entry_flags & STREAM_ITEM_FLAG_SAMEFIELDS) {
1240 *fieldptr = lpGet(si->master_fields_ptr,fieldlen,si->field_buf);
1241 si->master_fields_ptr = lpNext(si->lp,si->master_fields_ptr);
1242 } else {
1243 *fieldptr = lpGet(si->lp_ele,fieldlen,si->field_buf);
1244 si->lp_ele = lpNext(si->lp,si->lp_ele);
1245 }
1246 *valueptr = lpGet(si->lp_ele,valuelen,si->value_buf);
1247 si->lp_ele = lpNext(si->lp,si->lp_ele);
1248}
1249
1250/* Remove the current entry from the stream: can be called after the
1251 * GetID() API or after any GetField() call, however we need to iterate

Callers 4

rewriteStreamObjectFunction · 0.85
xorObjectDigestFunction · 0.85
streamReplyWithRangeFunction · 0.85

Calls 2

lpGetFunction · 0.85
lpNextFunction · 0.85

Tested by

no test coverage detected