Re: [PATCH 3/5] ch: use g_auto in virCHMonitorBuildMemoryJson

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/1/21 2:12 PM, William Douglas wrote:
Signed-off-by: William Douglas <william.douglas@xxxxxxxxx>
---
  src/ch/ch_monitor.c | 11 +++--------
  1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 800457af41..7326ac645b 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -154,22 +154,17 @@ virCHMonitorBuildKernelRelatedJson(virJSONValue *content, virDomainDef *vmdef)
  static int
  virCHMonitorBuildMemoryJson(virJSONValue *content, virDomainDef *vmdef)
  {
-    virJSONValue *memory;
      unsigned long long total_memory = virDomainDefGetMemoryInitial(vmdef) * 1024;
if (total_memory != 0) {
-        memory = virJSONValueNewObject();
+        g_autoptr(virJSONValue) memory = virJSONValueNewObject();

there should be an extra empy line here between variable definition and the start of instructions.

          if (virJSONValueObjectAppendNumberUlong(memory, "size", total_memory) < 0)
-            goto cleanup;
+            return -1;

also an empty line here makes the code more readable.

          if (virJSONValueObjectAppend(content, "memory", &memory) < 0)
-            goto cleanup;
+            return -1;
      }
return 0;
-
- cleanup:
-    virJSONValueFree(memory);
-    return -1;
  }
static int


Reviewed-by: Laine Stump <laine@xxxxxxxxxx>

I'll add the extra empty lines before pushing.




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux