use scm_malloc_pointerless to alloc aligned blocks in fallback
authorAndy Wingo <wingo@pobox.com>
Sat, 17 Jul 2010 10:22:17 +0000 (12:22 +0200)
committerAndy Wingo <wingo@pobox.com>
Sat, 17 Jul 2010 11:31:06 +0000 (13:31 +0200)
* libguile/continuations.c (SCM_DECLARE_STATIC_ALIGNED_ARRAY)
  (SCM_STATIC_ALIGNED_ARRAY)
* libguile/control.c (SCM_DECLARE_STATIC_ALIGNED_ARRAY)
  (SCM_STATIC_ALIGNED_ARRAY): Tweak backslashes. Use
  scm_malloc_pointerless to ensure alignment.

libguile/continuations.c
libguile/control.c

index dc504f0..b478963 100644 (file)
@@ -74,16 +74,15 @@ static scm_t_bits tc16_continuation;
 #define ALIGN_PTR(type,p,align) (type*)(ROUND_UP (((scm_t_bits)p), align))
 
 #ifdef SCM_ALIGNED
-#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)\
+#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)     \
 static const type sym[]
-#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym)\
+#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym)  \
 static SCM_ALIGNED (alignment) const type sym[]
 #else
-#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)\
+#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)     \
 static type *sym
 #define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym)                  \
-SCM_SNARF_INIT(sym = scm_malloc (sizeof(sym##__unaligned) + alignment - 1); \
-               sym = ALIGN_PTR (type, sym, alignment);                  \
+SCM_SNARF_INIT(sym = scm_malloc_pointerless (sizeof(sym##__unaligned)); \
                memcpy (sym, sym##__unaligned, sizeof(sym##__unaligned));) \
 static type *sym = NULL;                                                \
 static const type sym##__unaligned[]
index 6c20675..99bc846 100644 (file)
@@ -82,16 +82,15 @@ scm_i_prompt_pop_abort_args_x (SCM prompt)
 #define ALIGN_PTR(type,p,align) (type*)(ROUND_UP (((scm_t_bits)p), align))
 
 #ifdef SCM_ALIGNED
-#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)\
+#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)     \
 static const type sym[]
-#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym)\
+#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym)  \
 static SCM_ALIGNED (alignment) const type sym[]
 #else
-#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)\
+#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)     \
 static type *sym
 #define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym)                  \
-SCM_SNARF_INIT(sym = scm_malloc (sizeof(sym##__unaligned) + alignment - 1); \
-               sym = ALIGN_PTR (type, sym, alignment);                  \
+SCM_SNARF_INIT(sym = scm_malloc_pointerless (sizeof(sym##__unaligned); \
                memcpy (sym, sym##__unaligned, sizeof(sym##__unaligned));) \
 static type *sym = NULL;                                                \
 static const type sym##__unaligned[]