aboutsummaryrefslogtreecommitdiff
path: root/qemu-malloc.c
diff options
context:
space:
mode:
authormalc <av1474@comtv.ru>2009-05-19 22:28:26 +0400
committermalc <av1474@comtv.ru>2009-05-19 22:29:20 +0400
commit26d64a85a32192b559364f241908fb24cda378e6 (patch)
tree745d767425cb38ef36dd862e1ddbcdd8b8472f70 /qemu-malloc.c
parenta7d27b536ffc0773028a90f14580552c0c3ddb2a (diff)
Format per CODING_STYLE
Signed-off-by: malc <av1474@comtv.ru>
Diffstat (limited to 'qemu-malloc.c')
-rw-r--r--qemu-malloc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/qemu-malloc.c b/qemu-malloc.c
index 5e9f47f518..295d1856ef 100644
--- a/qemu-malloc.c
+++ b/qemu-malloc.c
@@ -26,8 +26,9 @@
static void *oom_check(void *ptr)
{
- if (ptr == NULL)
+ if (ptr == NULL) {
abort();
+ }
return ptr;
}
@@ -43,18 +44,20 @@ void qemu_free(void *ptr)
void *qemu_malloc(size_t size)
{
- if (!size)
+ if (!size) {
abort();
+ }
return oom_check(malloc(size));
}
void *qemu_realloc(void *ptr, size_t size)
{
- if (size)
+ if (size) {
return oom_check(realloc(ptr, size));
- else {
- if (ptr)
+ } else {
+ if (ptr) {
return realloc(ptr, size);
+ }
}
abort();
}
@@ -81,8 +84,9 @@ char *qemu_strndup(const char *str, size_t size)
const char *end = memchr(str, 0, size);
char *new;
- if (end)
+ if (end) {
size = end - str;
+ }
new = qemu_malloc(size + 1);
new[size] = 0;