summaryrefslogtreecommitdiff
path: root/lib/pool_alloc.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-07-21 23:12:02 -0700
committerWayne Davison <wayned@samba.org>2008-07-21 23:12:02 -0700
commit0566dc54b18fcaa6d666711ec3356bf6096af87e (patch)
tree65ae8b5f95dbfa5e5df46b95ea835ce20f80071f /lib/pool_alloc.c
parentaad635f766c450cd2cfac5fe5705213a417050b4 (diff)
downloadrsync-0566dc54b18fcaa6d666711ec3356bf6096af87e.tar.gz
rsync-0566dc54b18fcaa6d666711ec3356bf6096af87e.tar.bz2
rsync-0566dc54b18fcaa6d666711ec3356bf6096af87e.zip
Use PTR_ADD for the new instances of void-pointer arithmetic.
Diffstat (limited to 'lib/pool_alloc.c')
-rw-r--r--lib/pool_alloc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/pool_alloc.c b/lib/pool_alloc.c
index 6997ecfa..4c76d356 100644
--- a/lib/pool_alloc.c
+++ b/lib/pool_alloc.c
@@ -24,10 +24,10 @@ struct alloc_pool
struct pool_extent
{
+ struct pool_extent *next;
void *start; /* starting address */
size_t free; /* free bytecount */
size_t bound; /* trapped free bytes */
- struct pool_extent *next;
};
struct align_test {
@@ -101,7 +101,7 @@ pool_destroy(alloc_pool_t p)
for (cur = pool->extents; cur; cur = next) {
next = cur->next;
if (pool->flags & POOL_PREPEND)
- free(cur->start - sizeof (struct pool_extent));
+ free(PTR_ADD(cur->start, -sizeof (struct pool_extent)));
else {
free(cur->start);
free(cur);
@@ -148,7 +148,7 @@ pool_alloc(alloc_pool_t p, size_t len, const char *bomb_msg)
if (pool->flags & POOL_PREPEND) {
ext = start;
- start += sizeof (struct pool_extent);
+ start = PTR_ADD(start, sizeof (struct pool_extent));
} else if (!(ext = new(struct pool_extent)))
goto bomb_out;
ext->start = start;
@@ -236,7 +236,7 @@ pool_free(alloc_pool_t p, size_t len, void *addr)
if (cur->free + cur->bound >= pool->size) {
prev->next = cur->next;
if (pool->flags & POOL_PREPEND)
- free(cur->start - sizeof (struct pool_extent));
+ free(PTR_ADD(cur->start, -sizeof (struct pool_extent)));
else {
free(cur->start);
free(cur);
@@ -293,7 +293,7 @@ pool_free_old(alloc_pool_t p, void *addr)
while ((cur = next) != NULL) {
next = cur->next;
if (pool->flags & POOL_PREPEND)
- free(cur->start - sizeof (struct pool_extent));
+ free(PTR_ADD(cur->start, -sizeof (struct pool_extent)));
else {
free(cur->start);
free(cur);