Format per CODING_STYLE

Signed-off-by: malc <av1474@comtv.ru>
This commit is contained in:
malc 2009-05-19 22:28:26 +04:00
parent a7d27b536f
commit 26d64a85a3

View file

@ -26,8 +26,9 @@
static void *oom_check(void *ptr) static void *oom_check(void *ptr)
{ {
if (ptr == NULL) if (ptr == NULL) {
abort(); abort();
}
return ptr; return ptr;
} }
@ -43,18 +44,20 @@ void qemu_free(void *ptr)
void *qemu_malloc(size_t size) void *qemu_malloc(size_t size)
{ {
if (!size) if (!size) {
abort(); abort();
}
return oom_check(malloc(size)); return oom_check(malloc(size));
} }
void *qemu_realloc(void *ptr, size_t size) void *qemu_realloc(void *ptr, size_t size)
{ {
if (size) if (size) {
return oom_check(realloc(ptr, size)); return oom_check(realloc(ptr, size));
else { } else {
if (ptr) if (ptr) {
return realloc(ptr, size); return realloc(ptr, size);
}
} }
abort(); abort();
} }
@ -81,8 +84,9 @@ char *qemu_strndup(const char *str, size_t size)
const char *end = memchr(str, 0, size); const char *end = memchr(str, 0, size);
char *new; char *new;
if (end) if (end) {
size = end - str; size = end - str;
}
new = qemu_malloc(size + 1); new = qemu_malloc(size + 1);
new[size] = 0; new[size] = 0;