]> Shamusworld >> Repos - rmac/blobdiff - rmac.c
Code cleanup and prepartion for 64-bit host fixes
[rmac] / rmac.c
diff --git a/rmac.c b/rmac.c
index 3cc24f4e3ee74dc80416735311ede284c72cb74d..56ff27f014c685f6bb1a4d82d8ec10ce5013786a 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -308,14 +308,16 @@ char * amem(LONG amount)
 {
        char * p;
 
-       if (amount & 1)                                           // Keep word alignment
-               ++amount;
+//     if (amount & 1)                                                         // Keep word alignment
+//             amount++;
+       amount = (amount + 1) & ~(0x01);                        // Keep word alignment
 
+       // Honor *small* request (< 64 bytes)
        if (amount < A_THRESH)
-       {                                  // Honor *small* request
+       {
                if (a_amount < amount)
                {
-                       a_ptr = amem(A_AMOUNT);
+                       a_ptr = amem(A_AMOUNT);                         // Allocate 4K bytes
                        a_amount = A_AMOUNT;
                }
 
@@ -325,11 +327,11 @@ char * amem(LONG amount)
        }
        else
        {
-               amemtot += amount;                                    // Bump total alloc
-               p = (char *)malloc(amount);                           // Get memory from malloc
+               amemtot += amount;                                              // Bump total alloc
+               p = (char *)malloc(amount);                             // Get memory from malloc
 
-               if ((LONG)p == (LONG)NULL)
-                       fatal("memory exhausted");
+               if (p == NULL)
+                       fatal("Memory exhausted!");
 
                memset(p, 0, amount);
        }