diff options
author | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-03-23 01:21:46 +0100 |
---|---|---|
committer | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-03-23 01:21:46 +0100 |
commit | bb3475e8eb379ee18f3d8f37caa8040b852a6213 (patch) | |
tree | 89975f1c23814a7ab5e16f5c7887f55f1888a27a /adapters/glib.h | |
parent | aee72918851db8af296e096b759dfb7aaea17968 (diff) |
all: rename redis -> redict symbols and commentsmaster
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'adapters/glib.h')
-rw-r--r-- | adapters/glib.h | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/adapters/glib.h b/adapters/glib.h index f3143ed..84490c8 100644 --- a/adapters/glib.h +++ b/adapters/glib.h @@ -9,8 +9,8 @@ * */ -#ifndef __HIREDIS_GLIB_H__ -#define __HIREDIS_GLIB_H__ +#ifndef __HIREDICT_GLIB_H__ +#define __HIREDICT_GLIB_H__ #include <glib.h> @@ -20,55 +20,55 @@ typedef struct { GSource source; - redisAsyncContext *ac; + redictAsyncContext *ac; GPollFD poll_fd; -} RedisSource; +} RedictSource; static void -redis_source_add_read (gpointer data) +redict_source_add_read (gpointer data) { - RedisSource *source = (RedisSource *)data; + RedictSource *source = (RedictSource *)data; g_return_if_fail(source); source->poll_fd.events |= G_IO_IN; g_main_context_wakeup(g_source_get_context((GSource *)data)); } static void -redis_source_del_read (gpointer data) +redict_source_del_read (gpointer data) { - RedisSource *source = (RedisSource *)data; + RedictSource *source = (RedictSource *)data; g_return_if_fail(source); source->poll_fd.events &= ~G_IO_IN; g_main_context_wakeup(g_source_get_context((GSource *)data)); } static void -redis_source_add_write (gpointer data) +redict_source_add_write (gpointer data) { - RedisSource *source = (RedisSource *)data; + RedictSource *source = (RedictSource *)data; g_return_if_fail(source); source->poll_fd.events |= G_IO_OUT; g_main_context_wakeup(g_source_get_context((GSource *)data)); } static void -redis_source_del_write (gpointer data) +redict_source_del_write (gpointer data) { - RedisSource *source = (RedisSource *)data; + RedictSource *source = (RedictSource *)data; g_return_if_fail(source); source->poll_fd.events &= ~G_IO_OUT; g_main_context_wakeup(g_source_get_context((GSource *)data)); } static void -redis_source_cleanup (gpointer data) +redict_source_cleanup (gpointer data) { - RedisSource *source = (RedisSource *)data; + RedictSource *source = (RedictSource *)data; g_return_if_fail(source); - redis_source_del_read(source); - redis_source_del_write(source); + redict_source_del_read(source); + redict_source_del_write(source); /* * It is not our responsibility to remove ourself from the * current main loop. However, we will remove the GPollFD. @@ -80,36 +80,36 @@ redis_source_cleanup (gpointer data) } static gboolean -redis_source_prepare (GSource *source, +redict_source_prepare (GSource *source, gint *timeout_) { - RedisSource *redis = (RedisSource *)source; + RedictSource *redict = (RedictSource *)source; *timeout_ = -1; - return !!(redis->poll_fd.events & redis->poll_fd.revents); + return !!(redict->poll_fd.events & redict->poll_fd.revents); } static gboolean -redis_source_check (GSource *source) +redict_source_check (GSource *source) { - RedisSource *redis = (RedisSource *)source; - return !!(redis->poll_fd.events & redis->poll_fd.revents); + RedictSource *redict = (RedictSource *)source; + return !!(redict->poll_fd.events & redict->poll_fd.revents); } static gboolean -redis_source_dispatch (GSource *source, +redict_source_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) { - RedisSource *redis = (RedisSource *)source; + RedictSource *redict = (RedictSource *)source; - if ((redis->poll_fd.revents & G_IO_OUT)) { - redisAsyncHandleWrite(redis->ac); - redis->poll_fd.revents &= ~G_IO_OUT; + if ((redict->poll_fd.revents & G_IO_OUT)) { + redictAsyncHandleWrite(redict->ac); + redict->poll_fd.revents &= ~G_IO_OUT; } - if ((redis->poll_fd.revents & G_IO_IN)) { - redisAsyncHandleRead(redis->ac); - redis->poll_fd.revents &= ~G_IO_IN; + if ((redict->poll_fd.revents & G_IO_IN)) { + redictAsyncHandleRead(redict->ac); + redict->poll_fd.revents &= ~G_IO_IN; } if (callback) { @@ -120,31 +120,31 @@ redis_source_dispatch (GSource *source, } static void -redis_source_finalize (GSource *source) +redict_source_finalize (GSource *source) { - RedisSource *redis = (RedisSource *)source; + RedictSource *redict = (RedictSource *)source; - if (redis->poll_fd.fd >= 0) { - g_source_remove_poll(source, &redis->poll_fd); - redis->poll_fd.fd = -1; + if (redict->poll_fd.fd >= 0) { + g_source_remove_poll(source, &redict->poll_fd); + redict->poll_fd.fd = -1; } } static GSource * -redis_source_new (redisAsyncContext *ac) +redict_source_new (redictAsyncContext *ac) { static GSourceFuncs source_funcs = { - .prepare = redis_source_prepare, - .check = redis_source_check, - .dispatch = redis_source_dispatch, - .finalize = redis_source_finalize, + .prepare = redict_source_prepare, + .check = redict_source_check, + .dispatch = redict_source_dispatch, + .finalize = redict_source_finalize, }; - redisContext *c = &ac->c; - RedisSource *source; + redictContext *c = &ac->c; + RedictSource *source; g_return_val_if_fail(ac != NULL, NULL); - source = (RedisSource *)g_source_new(&source_funcs, sizeof *source); + source = (RedictSource *)g_source_new(&source_funcs, sizeof *source); if (source == NULL) return NULL; @@ -154,14 +154,14 @@ redis_source_new (redisAsyncContext *ac) source->poll_fd.revents = 0; g_source_add_poll((GSource *)source, &source->poll_fd); - ac->ev.addRead = redis_source_add_read; - ac->ev.delRead = redis_source_del_read; - ac->ev.addWrite = redis_source_add_write; - ac->ev.delWrite = redis_source_del_write; - ac->ev.cleanup = redis_source_cleanup; + ac->ev.addRead = redict_source_add_read; + ac->ev.delRead = redict_source_del_read; + ac->ev.addWrite = redict_source_add_write; + ac->ev.delWrite = redict_source_del_write; + ac->ev.cleanup = redict_source_cleanup; ac->ev.data = source; return (GSource *)source; } -#endif /* __HIREDIS_GLIB_H__ */ +#endif /* __HIREDICT_GLIB_H__ */ |