Skip to contentSkip to conversation

remove duplicate code

PATCH In review Glauber de Oliveira Costa 2 participants 2 messages Oct 2, 2007 – Oct 7, 2007 1 message not in the archive KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove duplicate code

This patch removes duplicate code at vl.c. Once the KVM-only part defines how much physicall memory it wants, the rest should be the same for everybody.

---
 qemu/vl.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
qemu/vl.c +8 -13
index fe49d2c..4f8cf51 100644
@@ -8657,20 +8657,15 @@ int main(int argc, char **argv)
 		    fprintf(stderr, "Could not create KVM context\n");
 		    exit(1);
 	    }
-    } else {
-	    phys_ram_base = qemu_vmalloc(phys_ram_size);
-	    if (!phys_ram_base) {
-		    fprintf(stderr, "Could not allocate physical memory\n");
-		    exit(1);
-	    }
-    }
-#else
-    phys_ram_base = qemu_vmalloc(phys_ram_size);
-    if (!phys_ram_base) {
-        fprintf(stderr, "Could not allocate physical memory\n");
-        exit(1);
-    }
+    } else
 #endif
+    {
+      phys_ram_base = qemu_vmalloc(phys_ram_size);
+      if (!phys_ram_base) {
+          fprintf(stderr, "Could not allocate physical memory\n");
+          exit(1);
+      }
+    }
 
     /* we always create the cdrom drive, even if no disk is there */
     bdrv_init();
Signature · 7 lines
1.4.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

A message that is not in the archive (sent off-list or not yet received): 11913574143708-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#2 lore raw
Quoted 33 lines · Glauber de Oliveira Costa

This patch removes duplicate code at vl.c. Once the KVM-only part defines how much physicall memory it wants, the rest should be the same for everybody.

---
 qemu/vl.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
qemu/vl.c +1 -13
index fe49d2c..4f8cf51 100644
@@ -8657,20 +8657,15 @@ int main(int argc, char **argv)
 		    fprintf(stderr, "Could not create KVM context\n");
 		    exit(1);
 	    }
-    } else {
-	    phys_ram_base = qemu_vmalloc(phys_ram_size);
-	    if (!phys_ram_base) {
-		    fprintf(stderr, "Could not allocate physical memory\n");
-		    exit(1);
-	    }
-    }
-#else
-    phys_ram_base = qemu_vmalloc(phys_ram_size);
-    if (!phys_ram_base) {
-        fprintf(stderr, "Could not allocate physical memory\n");
-        exit(1);
-    }
+    } else
 #endif

qemu/vl.c int main(int argc, char **argv) · line 8671

Quoted 10 lines
qemu/vl.c +7 -0
+    {
+      phys_ram_base = qemu_vmalloc(phys_ram_size);
+      if (!phys_ram_base) {
+          fprintf(stderr, "Could not allocate physical memory\n");
+          exit(1);
+      }
+    }
 
     /* we always create the cdrom drive, even if no disk is there */
     bdrv_init();

This touches original qemu lines, which is likely to cause me pain on the next merge. Maybe a goto after the kvm allocation code can remove the need to touch that code.

In any case this code is being worked on to be much more similar to regular qemu.

Signature · 8 lines
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/