[uim-commit] r2613 - branches/r5rs/sigscheme

yamaken at freedesktop.org yamaken at freedesktop.org
Fri Dec 16 13:00:17 PST 2005


Author: yamaken
Date: 2005-12-16 13:00:08 -0800 (Fri, 16 Dec 2005)
New Revision: 2613

Modified:
   branches/r5rs/sigscheme/alloc.c
   branches/r5rs/sigscheme/config.h
Log:
* sigscheme/config.h
  - (HAVE_POSIX_MEMALIGN): Disable when *BSD as temporary solution
* sigscheme/alloc.c
  - (scm_malloc_aligned):
    * Replace manual error handling for posix_memalign(3) with
      SCM_ASSERT_ALLOCATED()
    * Add alignment assertion for posix_memalign(3)


Modified: branches/r5rs/sigscheme/alloc.c
===================================================================
--- branches/r5rs/sigscheme/alloc.c	2005-12-16 10:23:12 UTC (rev 2612)
+++ branches/r5rs/sigscheme/alloc.c	2005-12-16 21:00:08 UTC (rev 2613)
@@ -83,9 +83,13 @@
      *     SUSv3.  The function memalign() appears in SunOS 4.1.3 but not in
      *     BSD 4.4.  The function posix_memalign() comes from POSIX 1003.1d.
      */
+    /* FIXME: replace the '16' with sizeof(ScmCell) if not required */
     posix_memalign(&p, 16, size);
-    if (!p)
-        ERR("memory exhausted");
+    SCM_ASSERT_ALLOCATED(p);
+#if SCM_DEBUG
+    /* check for buggy allocator */
+    assert(!((uintptr_t)p % 16));
+#endif
 #else
     p = scm_malloc(size);
     /* heaps must be aligned to sizeof(ScmCell) */

Modified: branches/r5rs/sigscheme/config.h
===================================================================
--- branches/r5rs/sigscheme/config.h	2005-12-16 10:23:12 UTC (rev 2612)
+++ branches/r5rs/sigscheme/config.h	2005-12-16 21:00:08 UTC (rev 2613)
@@ -124,7 +124,12 @@
  */
 #define HAVE_ASPRINTF           1
 #define HAVE_VASPRINTF          1
+/* FIXME */
+#if (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__))
+#define HAVE_POSIX_MEMALIGN     0
+#else
 #define HAVE_POSIX_MEMALIGN     1
+#endif
 
 /*===========================================================================
   Dependency Resolution



More information about the uim-commit mailing list