Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* minor mailx-5.5 bugfix
@ 1996-06-23  4:17 David Mosberger-Tang
  0 siblings, 0 replies; only message in thread
From: David Mosberger-Tang @ 1996-06-23  4:17 UTC (permalink / raw)


Hi Ken,

Here is a tiny patch that avoids getting unaligned faults on
Linux/Alpha.  Since pointers (and longs) are 64-bit large, salloc()
should return memory that is aligned at least to the size of a long.

	--david

--
--- mailx/mailx-5.5/strings.c~	Fri Dec 17 00:13:00 1993
+++ mailx/mailx-5.5/strings.c	Sat Jun 22 21:11:26 1996
@@ -48,10 +48,11 @@
 
 /*
  * Allocate size more bytes of space and return the address of the
- * first byte to the caller.  An even number of bytes are always
- * allocated so that the space will always be on a word boundary.
- * The string spaces are of exponentially increasing size, to satisfy
- * the occasional user with enormous string size requests.
+ * first byte to the caller.  An size that is an integer multiple of a
+ * "long" is always allocated so that the space will always be on a
+ * word boundary.  The string spaces are of exponentially increasing
+ * size, to satisfy the occasional user with enormous string size
+ * requests.
  */
 
 char *
@@ -63,8 +64,8 @@
 	int index;
 
 	s = size;
-	s += 3;
-	s &= ~03;
+	s += sizeof(long) - 1;
+	s &= ~(sizeof(long) - 1);
 	index = 0;
 	for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) {
 		if (sp->s_topFree == NOSTR && (STRINGSIZE << index) >= s)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-06-23  4:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-06-23  4:17 minor mailx-5.5 bugfix David Mosberger-Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox