git.samba.org
/
ira
/
third_party.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6ad5cc1
)
talloc: make really sure only optimize realloc if there's only one pool chunk
author
Stefan Metzmacher
<metze@samba.org>
Mon, 16 May 2011 18:15:59 +0000
(20:15 +0200)
committer
Karolin Seeger
<kseeger@samba.org>
Tue, 7 Jun 2011 17:59:53 +0000
(19:59 +0200)
*talloc_pool_objectcount(pool_tc) == 2 doesn't mean the one of the objects
is the pool itself! So we better check for == 1 and calculate the chunk count.
metze
(cherry picked from commit
7102105c8954627dc30a851327cf2642ac0783d5
)
(cherry picked from commit
8e95d3201adc546000ca29816c83aba6fab52b1a
)
talloc/talloc.c
patch
|
blob
|
history
diff --git
a/talloc/talloc.c
b/talloc/talloc.c
index fcd86d754a99990146d2aa3851c634e54fa5facf..f3ed9c85672679f11a7c1d734510930062fd8108 100644
(file)
--- a/
talloc/talloc.c
+++ b/
talloc/talloc.c
@@
-1479,8
+1479,13
@@
_PUBLIC_ void *_talloc_realloc(const void *context, void *ptr, size_t size, cons
size_t new_chunk_size = TC_ALIGN16(TC_HDR_SIZE + size);
size_t space_needed;
size_t space_left;
+ unsigned int chunk_count = *talloc_pool_objectcount(pool_tc);
- if (*talloc_pool_objectcount(pool_tc) == 2) {
+ if (!(pool_tc->flags & TALLOC_FLAG_FREE)) {
+ chunk_count -= 1;
+ }
+
+ if (chunk_count == 1) {
/*
* optimize for the case where 'tc' is the only
* chunk in the pool.