mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-01 20:49:35 -05:00
ITS#6437 cleanup (noop change): Simplify slap_sl_free() code reclaiming space
This commit is contained in:
parent
d8d00ec45c
commit
4c36193a5c
1 changed files with 11 additions and 13 deletions
|
|
@ -427,23 +427,21 @@ slap_sl_free(void *ptr, void *ctx)
|
|||
|
||||
if (!sh || ptr < sh->sh_base || ptr >= sh->sh_end) {
|
||||
ber_memfree_x(ptr, NULL);
|
||||
|
||||
} else if (sh->sh_stack) {
|
||||
tmpp = (ber_len_t *)((char *)ptr + p[-1]);
|
||||
size = p[-1];
|
||||
p = (ber_len_t *) ((char *) ptr + size);
|
||||
/* mark it free */
|
||||
tmpp[-1] |= 1;
|
||||
p[-1] = size |= 1;
|
||||
/* reclaim free space off tail */
|
||||
while ( tmpp == sh->sh_last ) {
|
||||
if ( tmpp[-1] & 1 ) {
|
||||
size = tmpp[-1] ^ 1;
|
||||
ptr = (char *)tmpp - size;
|
||||
p = (ber_len_t *)ptr;
|
||||
p--;
|
||||
sh->sh_last = p;
|
||||
tmpp = sh->sh_last;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if (sh->sh_last == p) {
|
||||
do {
|
||||
p = (ber_len_t *) ((char *) p - size + 1) - 1;
|
||||
size = p[-1];
|
||||
} while (size & 1);
|
||||
sh->sh_last = p;
|
||||
}
|
||||
|
||||
} else {
|
||||
int size_shift, order_size;
|
||||
struct slab_object *so;
|
||||
|
|
|
|||
Loading…
Reference in a new issue