From: David Mosberger-Tang <davidm@AZStarNet.com>
Subject: minor mailx-5.5 bugfix
Date: Sat, 22 Jun 1996 21:17:00 -0700 [thread overview]
Message-ID: <199606230417.VAA01117@panda.azstarnet.com> (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)
reply other threads:[~1996-06-23 4:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox