* 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:
parent
fc46e9fca8
commit
ed7fbf43c2
2 changed files with 10 additions and 5 deletions
|
@ -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>
|
||||
|
||||
* util/grub-fstest.c: Don't check for symlinks on windows.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue