summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-03-31 16:55:00 +0200
committerStefan Metzmacher <metze@samba.org>2011-04-08 09:28:10 +0200
commit4084cb723c4e14898a411fbd1cf8fa878ff290ff (patch)
treec311d451d1562ddfb4c2f93c892edf31f3323067
parentd39940113a24078bd563b0cfce4225648c632544 (diff)
downloadsamba-4084cb723c4e14898a411fbd1cf8fa878ff290ff.tar.gz
samba-4084cb723c4e14898a411fbd1cf8fa878ff290ff.tar.bz2
samba-4084cb723c4e14898a411fbd1cf8fa878ff290ff.zip
talloc: add TC_ALIGN16() macro
metze Signed-off-By: Andrew Tridgell <tridge@samba.org>
-rw-r--r--lib/talloc/talloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index 1c5f76922a..867705fdf4 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -147,7 +147,8 @@ struct talloc_chunk {
};
/* 16 byte alignment seems to keep everyone happy */
-#define TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15)
+#define TC_ALIGN16(s) (((s)+15)&~15)
+#define TC_HDR_SIZE TC_ALIGN16(sizeof(struct talloc_chunk))
#define TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc))
_PUBLIC_ int talloc_version_major(void)
@@ -370,7 +371,7 @@ static struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent,
/*
* Align size to 16 bytes
*/
- chunk_size = ((size + 15) & ~15);
+ chunk_size = TC_ALIGN16(size);
if (space_left < chunk_size) {
return NULL;