You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
-#include "mmalloc.h"
+#include "mmprivate.h"
PTR
mmemalign (md, alignment, size)
struct alignlist *l;
struct mdesc *mdp;
- size = ((size + alignment - 1) / alignment) * alignment;
-
- if ((result = mmalloc (md, size)) != NULL)
+ if ((result = mmalloc (md, size + alignment - 1)) != NULL)
{
adj = RESIDUAL (result, alignment);
if (adj != 0)
mfree (md, result);
return (NULL);
}
+ l -> next = mdp -> aligned_blocks;
+ mdp -> aligned_blocks = l;
}
l -> exact = result;
result = l -> aligned = (char *) result + alignment - adj;
- l -> next = mdp -> aligned_blocks;
- mdp -> aligned_blocks = l;
}
}
return (result);