Revision b152aa84 oslib-posix.c

b/oslib-posix.c
31 31
#include "trace.h"
32 32
#include "qemu_socket.h"
33 33

  
34
#if !defined(_POSIX_C_SOURCE) || defined(__sun__)
35
static void *oom_check(void *ptr)
34
void *qemu_oom_check(void *ptr)
36 35
{
37 36
    if (ptr == NULL) {
38 37
        fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno));
......
40 39
    }
41 40
    return ptr;
42 41
}
43
#endif
44 42

  
45 43
void *qemu_memalign(size_t alignment, size_t size)
46 44
{
......
54 52
        abort();
55 53
    }
56 54
#elif defined(CONFIG_BSD)
57
    ptr = oom_check(valloc(size));
55
    ptr = qemu_oom_check(valloc(size));
58 56
#else
59
    ptr = oom_check(memalign(alignment, size));
57
    ptr = qemu_oom_check(memalign(alignment, size));
60 58
#endif
61 59
    trace_qemu_memalign(alignment, size, ptr);
62 60
    return ptr;

Also available in: Unified diff