summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 41e5257)
raw | patch | inline | side by side (parent: 41e5257)
author | Shawn O. Pearce <spearce@spearce.org> | |
Thu, 24 Aug 2006 08:46:29 +0000 (04:46 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 14 Jan 2007 07:15:06 +0000 (02:15 -0500) |
Some architectures (e.g. SPARC) would require that we access pointers
only on pointer-sized alignments. So ensure the pool allocator
rounds out non-pointer sized allocations to the next pointer so we
don't generate bad memory addresses. This could have occurred if
we had previously allocated an atom whose string was not a whole
multiple of the pointer size, for example.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
only on pointer-sized alignments. So ensure the pool allocator
rounds out non-pointer sized allocations to the next pointer so we
don't generate bad memory addresses. This could have occurred if
we had previously allocated an atom whose string was not a whole
multiple of the pointer size, for example.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
fast-import.c | patch | blob | history |
diff --git a/fast-import.c b/fast-import.c
index 1c74b90c84f1c100cbf593a0e7bcd1fdafe40feb..e42bdbd3a3f81db0cde87a2b8d7c7fbbbfb97e02 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
}
r = p->next_free;
+ /* round out to a pointer alignment */
+ if (len & (sizeof(void*) - 1))
+ len += sizeof(void*) - (len & (sizeof(void*) - 1));
p->next_free += len;
return r;
}