summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2021-07-28 00:15:45 -0700
committerdormando <dormando@rydia.net>2021-08-09 17:09:08 -0700
commite52734366c94475db33d3239f48b4542ec2d9c2f (patch)
tree2a4ba068dcf8005aa3082d0c749437689fc6d978 /thread.c
parent38bc6e3513ad3783bb710120d66e84725e961fae (diff)
downloadmemcached-e52734366c94475db33d3239f48b4542ec2d9c2f.tar.gz
core: cache.c cleanups, use queue.h freelist
cache constructors/destructors were never used, which just ended up being wasted branches. Since there's no constructor/destructor for cache objects, we can use the memory itself for the freelist. This removes a doubling realloc for the freelist of cache objects and simplifies the code a bunch.
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/thread.c b/thread.c
index e4b1da7..874cc9c 100644
--- a/thread.c
+++ b/thread.c
@@ -424,7 +424,7 @@ static void setup_thread(LIBEVENT_THREAD *me) {
exit(EXIT_FAILURE);
}
- me->rbuf_cache = cache_create("rbuf", READ_BUFFER_SIZE, sizeof(char *), NULL, NULL);
+ me->rbuf_cache = cache_create("rbuf", READ_BUFFER_SIZE, sizeof(char *));
if (me->rbuf_cache == NULL) {
fprintf(stderr, "Failed to create read buffer cache\n");
exit(EXIT_FAILURE);
@@ -441,7 +441,7 @@ static void setup_thread(LIBEVENT_THREAD *me) {
cache_set_limit(me->rbuf_cache, limit);
}
- me->io_cache = cache_create("io", sizeof(io_pending_t), sizeof(char*), NULL, NULL);
+ me->io_cache = cache_create("io", sizeof(io_pending_t), sizeof(char*));
if (me->io_cache == NULL) {
fprintf(stderr, "Failed to create IO object cache\n");
exit(EXIT_FAILURE);