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

Function __redisPushCallback

deps/hiredis/async.c:245–265  ·  view source on GitHub ↗

Helper functions to push/shift callbacks */

Source from the content-addressed store, hash-verified

243
244/* Helper functions to push/shift callbacks */
245static int __redisPushCallback(redisCallbackList *list, redisCallback *source) {
246 redisCallback *cb;
247
248 /* Copy callback from stack to heap */
249 cb = hi_malloc(sizeof(*cb));
250 if (cb == NULL)
251 return REDIS_ERR_OOM;
252
253 if (source != NULL) {
254 memcpy(cb,source,sizeof(*cb));
255 cb->next = NULL;
256 }
257
258 /* Store callback in list */
259 if (list->head == NULL)
260 list->head = cb;
261 if (list->tail != NULL)
262 list->tail->next = cb;
263 list->tail = cb;
264 return REDIS_OK;
265}
266
267static int __redisShiftCallback(redisCallbackList *list, redisCallback *target) {
268 redisCallback *cb = list->head;

Callers 2

redisProcessCallbacksFunction · 0.85
__redisAsyncCommandFunction · 0.85

Calls 1

hi_mallocFunction · 0.70

Tested by

no test coverage detected