summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-06-23 09:38:30 +0200
committerantirez <antirez@gmail.com>2016-06-23 09:38:30 +0200
commitb507289750eb77b554847afa03da8eb044f49a3a (patch)
tree28bbb6edbfd663e297e07fb0be8065b6a0ee9eeb
parentf2dbc02f6510cc3cc415ac354888948af64434d1 (diff)
downloadredis-b507289750eb77b554847afa03da8eb044f49a3a.tar.gz
Commit change in autoMemoryFreed(): first -> last.
It's more natural to call the last entry added as "last", the original commet got me confused until I actually read the code.
-rw-r--r--src/module.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/module.c b/src/module.c
index d77a8f956..3bff47793 100644
--- a/src/module.c
+++ b/src/module.c
@@ -621,11 +621,12 @@ void autoMemoryFreed(RedisModuleCtx *ctx, int type, void *ptr) {
{
ctx->amqueue[i].type = REDISMODULE_AM_FREED;
- /* Switch the freed element and the top element, to avoid growing
+ /* Switch the freed element and the last element, to avoid growing
* the queue unnecessarily if we allocate/free in a loop */
if (i != ctx->amqueue_used-1) {
ctx->amqueue[i] = ctx->amqueue[ctx->amqueue_used-1];
}
+
/* Reduce the size of the queue because we either moved the top
* element elsewhere or freed it */
ctx->amqueue_used--;