[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/gmalloc.c,v [EMACS_22_BASE]
From: |
YAMAMOTO Mitsuharu |
Subject: |
[Emacs-diffs] Changes to emacs/src/gmalloc.c,v [EMACS_22_BASE] |
Date: |
Thu, 09 Aug 2007 03:08:02 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Branch: EMACS_22_BASE
Changes by: YAMAMOTO Mitsuharu <mituharu> 07/08/09 03:08:01
Index: gmalloc.c
===================================================================
RCS file: /sources/emacs/emacs/src/gmalloc.c,v
retrieving revision 1.21.2.4
retrieving revision 1.21.2.5
diff -u -b -r1.21.2.4 -r1.21.2.5
--- gmalloc.c 7 Aug 2007 09:04:33 -0000 1.21.2.4
+++ gmalloc.c 9 Aug 2007 03:08:01 -0000 1.21.2.5
@@ -129,6 +129,8 @@
#if ! (defined (_MALLOC_INTERNAL) && __DJGPP__ - 0 == 1) /* Avoid conflict. */
extern __ptr_t memalign PP ((__malloc_size_t __alignment,
__malloc_size_t __size));
+extern int posix_memalign PP ((__ptr_t *, __malloc_size_t,
+ __malloc_size_t size));
#endif
/* Allocate SIZE bytes on a page boundary. */
@@ -1857,6 +1859,36 @@
return result;
}
+#ifndef ENOMEM
+#define ENOMEM 12
+#endif
+
+#ifndef EINVAL
+#define EINVAL 22
+#endif
+
+int
+posix_memalign (memptr, alignment, size)
+ __ptr_t *memptr;
+ __malloc_size_t alignment;
+ __malloc_size_t size;
+{
+ __ptr_t mem;
+
+ if (alignment == 0
+ || alignment % sizeof (__ptr_t) != 0
+ || (alignment & (alignment - 1)) != 0)
+ return EINVAL;
+
+ mem = memalign (alignment, size);
+ if (mem == NULL)
+ return ENOMEM;
+
+ *memptr = mem;
+
+ return 0;
+}
+
#endif /* Not DJGPP v1 */
/* Allocate memory on a page boundary.
Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.