From: Andy Fiddaman (no email)
Date: Sun Sep 16 2007 - 14:43:40 EDT
On Fri, 14 Sep 2007, Ken Murchison wrote:
; This patch tries to force the entire buffer to be aligned, rather than
; aligning each 64-bit field individually. Don't know if this will work or not.
The concept seems to work fine. There are some other places that
the same trick needs to be done - mailbox_expunge() and restore_expunged()
for example.
I adapted it slightly (see attachment) to use a union to conserve heap
space and a macro given the number of places it was proving necessary.
I also tried using the GNUC extension of specifying alignment but
it doesn't seem to work at all for me so I commented it out.
The following two bits aren't required - the pointer doesn't need to be
aligned, just the memory to which it points. That is already
done by malloc(). Also I don't think that anonymous unions are standard C.
- unsigned char *buf = NULL;
+ struct {
+#ifdef HAVE_LONG_LONG_INT
+ bit64 align8;
+#endif
+ unsigned char *buf;
+ } align8buf;
+ unsigned char *buf = align8buf.buf = NULL;
&
- const char *index_base;
+ union {
+#ifdef HAVE_LONG_LONG_INT
+ bit64 align8;
+#endif
+ const char *index_base;
+ };
I haven't had much time to look at split_attribs() properly so I just
left that the way my previous patch worked for now.
Andy
---- Cyrus Home Page: http://cyrusimap.web.cmu.edu/ Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html
|
|
|