From bb3475e8eb379ee18f3d8f37caa8040b852a6213 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Sat, 23 Mar 2024 01:21:46 +0100 Subject: all: rename redis -> redict symbols and comments Signed-off-by: Anna (navi) Figueiredo Gomes --- adapters/macosx.h | 110 +++++++++++++++++++++++++++--------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'adapters/macosx.h') diff --git a/adapters/macosx.h b/adapters/macosx.h index 7ae5e5a..670ca62 100644 --- a/adapters/macosx.h +++ b/adapters/macosx.h @@ -9,8 +9,8 @@ * */ -#ifndef __HIREDIS_MACOSX_H__ -#define __HIREDIS_MACOSX_H__ +#ifndef __HIREDICT_MACOSX_H__ +#define __HIREDICT_MACOSX_H__ #include @@ -18,61 +18,61 @@ #include "../async.h" typedef struct { - redisAsyncContext *context; + redictAsyncContext *context; CFSocketRef socketRef; CFRunLoopSourceRef sourceRef; -} RedisRunLoop; +} RedictRunLoop; -static int freeRedisRunLoop(RedisRunLoop* redisRunLoop) { - if( redisRunLoop != NULL ) { - if( redisRunLoop->sourceRef != NULL ) { - CFRunLoopSourceInvalidate(redisRunLoop->sourceRef); - CFRelease(redisRunLoop->sourceRef); +static int freeRedictRunLoop(RedictRunLoop* redictRunLoop) { + if( redictRunLoop != NULL ) { + if( redictRunLoop->sourceRef != NULL ) { + CFRunLoopSourceInvalidate(redictRunLoop->sourceRef); + CFRelease(redictRunLoop->sourceRef); } - if( redisRunLoop->socketRef != NULL ) { - CFSocketInvalidate(redisRunLoop->socketRef); - CFRelease(redisRunLoop->socketRef); + if( redictRunLoop->socketRef != NULL ) { + CFSocketInvalidate(redictRunLoop->socketRef); + CFRelease(redictRunLoop->socketRef); } - hi_free(redisRunLoop); + hi_free(redictRunLoop); } - return REDIS_ERR; + return REDICT_ERR; } -static void redisMacOSAddRead(void *privdata) { - RedisRunLoop *redisRunLoop = (RedisRunLoop*)privdata; - CFSocketEnableCallBacks(redisRunLoop->socketRef, kCFSocketReadCallBack); +static void redictMacOSAddRead(void *privdata) { + RedictRunLoop *redictRunLoop = (RedictRunLoop*)privdata; + CFSocketEnableCallBacks(redictRunLoop->socketRef, kCFSocketReadCallBack); } -static void redisMacOSDelRead(void *privdata) { - RedisRunLoop *redisRunLoop = (RedisRunLoop*)privdata; - CFSocketDisableCallBacks(redisRunLoop->socketRef, kCFSocketReadCallBack); +static void redictMacOSDelRead(void *privdata) { + RedictRunLoop *redictRunLoop = (RedictRunLoop*)privdata; + CFSocketDisableCallBacks(redictRunLoop->socketRef, kCFSocketReadCallBack); } -static void redisMacOSAddWrite(void *privdata) { - RedisRunLoop *redisRunLoop = (RedisRunLoop*)privdata; - CFSocketEnableCallBacks(redisRunLoop->socketRef, kCFSocketWriteCallBack); +static void redictMacOSAddWrite(void *privdata) { + RedictRunLoop *redictRunLoop = (RedictRunLoop*)privdata; + CFSocketEnableCallBacks(redictRunLoop->socketRef, kCFSocketWriteCallBack); } -static void redisMacOSDelWrite(void *privdata) { - RedisRunLoop *redisRunLoop = (RedisRunLoop*)privdata; - CFSocketDisableCallBacks(redisRunLoop->socketRef, kCFSocketWriteCallBack); +static void redictMacOSDelWrite(void *privdata) { + RedictRunLoop *redictRunLoop = (RedictRunLoop*)privdata; + CFSocketDisableCallBacks(redictRunLoop->socketRef, kCFSocketWriteCallBack); } -static void redisMacOSCleanup(void *privdata) { - RedisRunLoop *redisRunLoop = (RedisRunLoop*)privdata; - freeRedisRunLoop(redisRunLoop); +static void redictMacOSCleanup(void *privdata) { + RedictRunLoop *redictRunLoop = (RedictRunLoop*)privdata; + freeRedictRunLoop(redictRunLoop); } -static void redisMacOSAsyncCallback(CFSocketRef __unused s, CFSocketCallBackType callbackType, CFDataRef __unused address, const void __unused *data, void *info) { - redisAsyncContext* context = (redisAsyncContext*) info; +static void redictMacOSAsyncCallback(CFSocketRef __unused s, CFSocketCallBackType callbackType, CFDataRef __unused address, const void __unused *data, void *info) { + redictAsyncContext* context = (redictAsyncContext*) info; switch (callbackType) { case kCFSocketReadCallBack: - redisAsyncHandleRead(context); + redictAsyncHandleRead(context); break; case kCFSocketWriteCallBack: - redisAsyncHandleWrite(context); + redictAsyncHandleWrite(context); break; default: @@ -80,41 +80,41 @@ static void redisMacOSAsyncCallback(CFSocketRef __unused s, CFSocketCallBackType } } -static int redisMacOSAttach(redisAsyncContext *redisAsyncCtx, CFRunLoopRef runLoop) { - redisContext *redisCtx = &(redisAsyncCtx->c); +static int redictMacOSAttach(redictAsyncContext *redictAsyncCtx, CFRunLoopRef runLoop) { + redictContext *redictCtx = &(redictAsyncCtx->c); /* Nothing should be attached when something is already attached */ - if( redisAsyncCtx->ev.data != NULL ) return REDIS_ERR; + if( redictAsyncCtx->ev.data != NULL ) return REDICT_ERR; - RedisRunLoop* redisRunLoop = (RedisRunLoop*) hi_calloc(1, sizeof(RedisRunLoop)); - if (redisRunLoop == NULL) - return REDIS_ERR; + RedictRunLoop* redictRunLoop = (RedictRunLoop*) hi_calloc(1, sizeof(RedictRunLoop)); + if (redictRunLoop == NULL) + return REDICT_ERR; - /* Setup redis stuff */ - redisRunLoop->context = redisAsyncCtx; + /* Setup redict stuff */ + redictRunLoop->context = redictAsyncCtx; - redisAsyncCtx->ev.addRead = redisMacOSAddRead; - redisAsyncCtx->ev.delRead = redisMacOSDelRead; - redisAsyncCtx->ev.addWrite = redisMacOSAddWrite; - redisAsyncCtx->ev.delWrite = redisMacOSDelWrite; - redisAsyncCtx->ev.cleanup = redisMacOSCleanup; - redisAsyncCtx->ev.data = redisRunLoop; + redictAsyncCtx->ev.addRead = redictMacOSAddRead; + redictAsyncCtx->ev.delRead = redictMacOSDelRead; + redictAsyncCtx->ev.addWrite = redictMacOSAddWrite; + redictAsyncCtx->ev.delWrite = redictMacOSDelWrite; + redictAsyncCtx->ev.cleanup = redictMacOSCleanup; + redictAsyncCtx->ev.data = redictRunLoop; /* Initialize and install read/write events */ - CFSocketContext socketCtx = { 0, redisAsyncCtx, NULL, NULL, NULL }; + CFSocketContext socketCtx = { 0, redictAsyncCtx, NULL, NULL, NULL }; - redisRunLoop->socketRef = CFSocketCreateWithNative(NULL, redisCtx->fd, + redictRunLoop->socketRef = CFSocketCreateWithNative(NULL, redictCtx->fd, kCFSocketReadCallBack | kCFSocketWriteCallBack, - redisMacOSAsyncCallback, + redictMacOSAsyncCallback, &socketCtx); - if( !redisRunLoop->socketRef ) return freeRedisRunLoop(redisRunLoop); + if( !redictRunLoop->socketRef ) return freeRedictRunLoop(redictRunLoop); - redisRunLoop->sourceRef = CFSocketCreateRunLoopSource(NULL, redisRunLoop->socketRef, 0); - if( !redisRunLoop->sourceRef ) return freeRedisRunLoop(redisRunLoop); + redictRunLoop->sourceRef = CFSocketCreateRunLoopSource(NULL, redictRunLoop->socketRef, 0); + if( !redictRunLoop->sourceRef ) return freeRedictRunLoop(redictRunLoop); - CFRunLoopAddSource(runLoop, redisRunLoop->sourceRef, kCFRunLoopDefaultMode); + CFRunLoopAddSource(runLoop, redictRunLoop->sourceRef, kCFRunLoopDefaultMode); - return REDIS_OK; + return REDICT_OK; } #endif -- cgit v1.2.3