commit 1f477047c116ecb91998d66d65dfa797b265aa5b
parent 14777f12c4e774b2b3ce2b9cdbd79b85ea215f18
Author: sin <sin@2f30.org>
Date: Mon, 5 Aug 2013 14:54:10 +0100
No need to lookup `oldp' again, we already have a pointer to it
Diffstat:
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/lemoncake.c b/lemoncake.c
@@ -278,12 +278,8 @@ realloc(void *oldp, size_t siz)
memcpy(newan->buf, oldan->buf,
siz < oldan->siz ? siz : oldan->siz);
/* Return `oldp' to the free tree */
- n.buf = oldan;
- res = RB_FIND(alloc_tree, &at, &n);
- if (res) {
- fn = RB_REMOVE(alloc_tree, &at, res);
- RB_INSERT(free_tree, &ft, fn);
- }
+ fn = RB_REMOVE(alloc_tree, &at, oldan);
+ RB_INSERT(free_tree, &ft, fn);
unlock(&rblock);
st.nr_realloc++;
return newan->buf;