diff options
author | antirez <antirez@gmail.com> | 2016-07-11 19:18:17 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2016-07-11 19:18:17 +0200 |
commit | 382991f82ee1cc213e4225ce5f28284974715def (patch) | |
tree | 178707d0dc9a776c8971cefebb5487740a3e1869 /src/evict.c | |
parent | b19b2dff46f013b256f6966d3ace0d1cebcc10be (diff) | |
download | redis-382991f82ee1cc213e4225ce5f28284974715def.tar.gz |
Remove useless memmove() from freeMemoryIfNeeded().
We start from the end of the pool to the initial item, zero-ing
every entry we use or every ghost entry, there is nothing to memmove
since to the right everything should be already set to NULL.
Diffstat (limited to 'src/evict.c')
-rw-r--r-- | src/evict.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/evict.c b/src/evict.c index c35b10b8f..bc3c9de24 100644 --- a/src/evict.c +++ b/src/evict.c @@ -264,13 +264,8 @@ int freeMemoryIfNeeded(void) { /* Remove the entry from the pool. */ sdsfree(pool[k].key); - /* Shift all elements on its right to left. */ - memmove(pool+k,pool+k+1, - sizeof(pool[0])*(MAXMEMORY_EVICTION_POOL_SIZE-k-1)); - /* Clear the element on the right which is empty - * since we shifted one position to the left. */ - pool[MAXMEMORY_EVICTION_POOL_SIZE-1].key = NULL; - pool[MAXMEMORY_EVICTION_POOL_SIZE-1].idle = 0; + pool[k].key = NULL; + pool[k].idle = 0; /* If the key exists, is our pick. Otherwise it is * a ghost and we need to try the next element. */ |