diff --git a/ChangeLog b/ChangeLog index cba3f22c2..accdd4c67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-08-22 Vladimir Serbinenko + + * grub-core/kern/emu/mm.c (grub_memalign): Don't define if there is no + implementation available to cause compile-time rather than runtime + error. + 2013-08-22 Vladimir Serbinenko * util/grub-fstest.c: Don't check for symlinks on windows. diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c index 0461ea51c..10e1cc0d9 100644 --- a/grub-core/kern/emu/mm.c +++ b/grub-core/kern/emu/mm.c @@ -63,22 +63,20 @@ grub_realloc (void *ptr, grub_size_t size) return ret; } +#if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_MEMALIGN) void * grub_memalign (grub_size_t align, grub_size_t size) { void *p; -#if defined(HAVE_POSIX_MEMALIGN) if (align < sizeof (void *)) align = sizeof (void *); + +#if defined(HAVE_POSIX_MEMALIGN) if (posix_memalign (&p, align, size) != 0) p = 0; #elif defined(HAVE_MEMALIGN) p = memalign (align, size); -#else - (void) align; - (void) size; - grub_util_error (_("grub_memalign is not supported on your system")); #endif if (!p) @@ -86,3 +84,4 @@ grub_memalign (grub_size_t align, grub_size_t size) return p; } +#endif