* 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.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-08-22 16:16:29 +02:00
parent fc46e9fca8
commit ed7fbf43c2
2 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2013-08-22 Vladimir Serbinenko <phcoder@gmail.com>
* 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 <phcoder@gmail.com> 2013-08-22 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-fstest.c: Don't check for symlinks on windows. * util/grub-fstest.c: Don't check for symlinks on windows.

View file

@ -63,22 +63,20 @@ grub_realloc (void *ptr, grub_size_t size)
return ret; return ret;
} }
#if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_MEMALIGN)
void * void *
grub_memalign (grub_size_t align, grub_size_t size) grub_memalign (grub_size_t align, grub_size_t size)
{ {
void *p; void *p;
#if defined(HAVE_POSIX_MEMALIGN)
if (align < sizeof (void *)) if (align < sizeof (void *))
align = sizeof (void *); align = sizeof (void *);
#if defined(HAVE_POSIX_MEMALIGN)
if (posix_memalign (&p, align, size) != 0) if (posix_memalign (&p, align, size) != 0)
p = 0; p = 0;
#elif defined(HAVE_MEMALIGN) #elif defined(HAVE_MEMALIGN)
p = memalign (align, size); p = memalign (align, size);
#else
(void) align;
(void) size;
grub_util_error (_("grub_memalign is not supported on your system"));
#endif #endif
if (!p) if (!p)
@ -86,3 +84,4 @@ grub_memalign (grub_size_t align, grub_size_t size)
return p; return p;
} }
#endif