diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-02-17 13:25:25 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-02-17 13:25:25 +0000 |
commit | 580011677c460165a0f3907879155a9a9d2b3891 (patch) | |
tree | cea9c5f4cdbd48072e4816d1f87a9500667f21aa /src/libserver | |
parent | 361fb6df11468548eb57856dad2e74b082dd7085 (diff) | |
download | rspamd-580011677c460165a0f3907879155a9a9d2b3891.tar.gz rspamd-580011677c460165a0f3907879155a9a9d2b3891.zip |
[Minor] Add routine to convert redis reply type to string
Issue: #1228
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/redis_pool.c | 31 | ||||
-rw-r--r-- | src/libserver/redis_pool.h | 7 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/libserver/redis_pool.c b/src/libserver/redis_pool.c index 5cb898648..0b7c30844 100644 --- a/src/libserver/redis_pool.c +++ b/src/libserver/redis_pool.c @@ -455,3 +455,34 @@ rspamd_redis_pool_destroy (struct rspamd_redis_pool *pool) g_slice_free1 (sizeof (*pool), pool); } + +const gchar* +rspamd_redis_type_to_string (int type) +{ + const gchar *ret = "unknown"; + + switch (type) { + case REDIS_REPLY_STRING: + ret = "string"; + break; + case REDIS_REPLY_ARRAY: + ret = "array"; + break; + case REDIS_REPLY_INTEGER: + ret = "int"; + break; + case REDIS_REPLY_STATUS: + ret = "status"; + break; + case REDIS_REPLY_NIL: + ret = "nil"; + break; + case REDIS_REPLY_ERROR: + ret = "error"; + break; + default: + break; + } + + return ret; +} diff --git a/src/libserver/redis_pool.h b/src/libserver/redis_pool.h index 5e5dc0b5d..a43b6d7e2 100644 --- a/src/libserver/redis_pool.h +++ b/src/libserver/redis_pool.h @@ -67,4 +67,11 @@ void rspamd_redis_pool_release_connection (struct rspamd_redis_pool *pool, */ void rspamd_redis_pool_destroy (struct rspamd_redis_pool *pool); +/** + * Missing in hiredis + * @param type + * @return + */ +const gchar* rspamd_redis_type_to_string (int type); + #endif /* SRC_LIBSERVER_REDIS_POOL_H_ */ |