Hi, On Mon, Jul 17, 2006 at 10:12:21AM +0200, Philip Van Hoof wrote: > > If the point of this is to align the "string" member as a pointer > > would, 4 is not correct alignment for 64-bit architectures. > > Regretfully, I can't change the structs. They are, in fact, put in the > structs as char pointers. What I do is calculate the offset in the > memory of the mmap to where these pointers need to point to. > > The struct instances are kept alive for as long as the mmap isn't > munmap'ed. When the mmap gets munmap'ed, the struct instances also need > to die. > ... [the code at the bottom] > > I cannot change these "to, from nor subject" pointers. These are used > in thousands of lines of Evolution code that I don't want to change.
There's no need to align access to chars. Is there something that accesses the saved data as shorts, longs (ints), floats or doubles? Or casts the char pointers e.g. into int *? (use -Wcast-align) - Eero > So it's more 'like' this (almost pseudo): > > typedef struct _CamelMessageInfo CamelMessageInfo; > struct _CamelMessageInfo > { > /* .. */ > char *to, *from, *subject; > /* .. */ > > unsigned char *mmap_addr; > }; > > CamelMessageInfo* > message_info_load (CamelSummaryInfo *s) > { > CamelMessageInfo *mi = malloc (sizeof (CamelMessageInfo ...)); > > mi->to = mmap_addr; > mmap_addr += length-of mi->to > mi->from = mmap_addr; > > etc etc > > return mi; > } > > CamelFolderSummary* > folder_summary_load () > { > CamelFolderSummary *s = ... > > s->mmap_addr = mmap (...); > > folder_header_load (s); > > for (i=0< i< s->message_count_in_header; s++) > { > CamelMessageInfo *mi; > mi = message_info_load (s); > > folder_summary_add_mi (s, mi); > } > } > > > I cannot change these "to, from nor subject" pointers. These are used in > thousands of lines of Evolution code that I don't want to change. _______________________________________________ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers