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

yamaken at freedesktop.org yamaken at freedesktop.org
Tue Dec 6 07:31:19 PST 2005


Author: yamaken
Date: 2005-12-06 07:31:14 -0800 (Tue, 06 Dec 2005)
New Revision: 2395

Modified:
   branches/r5rs/sigscheme/config.h
   branches/r5rs/sigscheme/storage-gc.c
Log:
* sigscheme/config.h
  - (HAVE_POSIX_MEMALIGN): New macro
* sigscheme/storage-gc.c
  - (malloc_aligned): Resurrect posix_memalign(3) for HAVE_POSIX_MEMALIGN
  - Remove obsolete wordaround for posix_memalign(3)


Modified: branches/r5rs/sigscheme/config.h
===================================================================
--- branches/r5rs/sigscheme/config.h	2005-12-06 15:25:03 UTC (rev 2394)
+++ branches/r5rs/sigscheme/config.h	2005-12-06 15:31:14 UTC (rev 2395)
@@ -123,6 +123,7 @@
  */
 #define HAVE_ASPRINTF           1
 #define HAVE_VASPRINTF          1
+#define HAVE_POSIX_MEMALIGN     0
 
 /*===========================================================================
   Dependency Resolution

Modified: branches/r5rs/sigscheme/storage-gc.c
===================================================================
--- branches/r5rs/sigscheme/storage-gc.c	2005-12-06 15:25:03 UTC (rev 2394)
+++ branches/r5rs/sigscheme/storage-gc.c	2005-12-06 15:31:14 UTC (rev 2395)
@@ -66,29 +66,6 @@
 #include <assert.h>
 
 /*=======================================
-  Portability Coordination
-=======================================*/
-#if 0
-/* malloc.h is obsoleted by stdlib.h. At least FreeBSD generates an error. */
-#include <malloc.h>
-#endif
-
-#if 0
-#ifndef posix_memalign
-/*
- * Cited from manpage of posix_memalign(3) of glibc:
- *
- * CONFORMING TO
- *     The  function  valloc()  appeared in 3.0 BSD. It is documented as being
- *     obsolete in BSD 4.3, and as legacy in SUSv2. It  no  longer  occurs  in
- *     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.
- */
-#error "posix_memalign(3) is not available in this system"
-#endif
-#endif
-
-/*=======================================
   Local Include
 =======================================*/
 #include "sigscheme.h"
@@ -273,15 +250,23 @@
 static void *malloc_aligned(size_t size)
 {
     void *p;
-    /* 2005/08/08  Kazuki Ohta  <mover at hct.zaq.ne.jp>
-     * commented out "posix_memalign"
+
+#if HAVE_POSIX_MEMALIGN
+    /*
+     * Cited from manpage of posix_memalign(3) of glibc:
      *
-     * posix_memalign(&p, 16, size);
+     * CONFORMING TO
+     *     The function valloc() appeared in 3.0 BSD. It is documented as being
+     *     obsolete in BSD 4.3, and as legacy in SUSv2. It no longer occurs in
+     *     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.
      */
+    posix_memalign(&p, 16, size);
+#else
     p = malloc(size);
-
     /* heaps must be aligned to sizeof(ScmCell) */
     assert(!((uintptr_t)p % sizeof(ScmCell)));
+#endif
 
     return p;
 }



More information about the uim-commit mailing list