Commit 26d64a85a32192b559364f241908fb24cda378e6

Authored by malc
1 parent a7d27b53

Format per CODING_STYLE

Signed-off-by: malc <av1474@comtv.ru>
Showing 1 changed file with 10 additions and 6 deletions
qemu-malloc.c
... ... @@ -26,8 +26,9 @@
26 26  
27 27 static void *oom_check(void *ptr)
28 28 {
29   - if (ptr == NULL)
  29 + if (ptr == NULL) {
30 30 abort();
  31 + }
31 32 return ptr;
32 33 }
33 34  
... ... @@ -43,18 +44,20 @@ void qemu_free(void *ptr)
43 44  
44 45 void *qemu_malloc(size_t size)
45 46 {
46   - if (!size)
  47 + if (!size) {
47 48 abort();
  49 + }
48 50 return oom_check(malloc(size));
49 51 }
50 52  
51 53 void *qemu_realloc(void *ptr, size_t size)
52 54 {
53   - if (size)
  55 + if (size) {
54 56 return oom_check(realloc(ptr, size));
55   - else {
56   - if (ptr)
  57 + } else {
  58 + if (ptr) {
57 59 return realloc(ptr, size);
  60 + }
58 61 }
59 62 abort();
60 63 }
... ... @@ -81,8 +84,9 @@ char *qemu_strndup(const char *str, size_t size)
81 84 const char *end = memchr(str, 0, size);
82 85 char *new;
83 86  
84   - if (end)
  87 + if (end) {
85 88 size = end - str;
  89 + }
86 90  
87 91 new = qemu_malloc(size + 1);
88 92 new[size] = 0;
... ...