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

Function redisReaderCreateWithFunctions

app/redis-6.2.6/deps/hiredis/read.c:605–635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603}
604
605redisReader *redisReaderCreateWithFunctions(redisReplyObjectFunctions *fn) {
606 redisReader *r;
607
608 r = hi_calloc(1,sizeof(redisReader));
609 if (r == NULL)
610 return NULL;
611
612 r->buf = hi_sdsempty();
613 if (r->buf == NULL)
614 goto oom;
615
616 r->task = hi_calloc(REDIS_READER_STACK_SIZE, sizeof(*r->task));
617 if (r->task == NULL)
618 goto oom;
619
620 for (; r->tasks < REDIS_READER_STACK_SIZE; r->tasks++) {
621 r->task[r->tasks] = hi_calloc(1, sizeof(**r->task));
622 if (r->task[r->tasks] == NULL)
623 goto oom;
624 }
625
626 r->fn = fn;
627 r->maxbuf = REDIS_READER_MAX_BUF;
628 r->maxelements = REDIS_READER_MAX_ARRAY_ELEMENTS;
629 r->ridx = -1;
630
631 return r;
632oom:
633 redisReaderFree(r);
634 return NULL;
635}
636
637void redisReaderFree(redisReader *r) {
638 if (r == NULL)

Callers 1

redisReaderCreateFunction · 0.85

Calls 3

hi_sdsemptyFunction · 0.85
redisReaderFreeFunction · 0.85
hi_callocFunction · 0.70

Tested by

no test coverage detected