Skip to contentSkip to conversation

remove duplicate code

PATCH In review Glauber de Oliveira Costa 2 participants 2 messages Oct 2, 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 +9 -14
index fe49d2c..4f8cf51 100644
@@ -8246,7 +8246,7 @@ int main(int argc, char **argv)
                     help(1);
                 if (ram_size > PHYS_RAM_MAX_SIZE) {
                     fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n",
-                            PHYS_RAM_MAX_SIZE / (1024 * 1024));
+                            (int)PHYS_RAM_MAX_SIZE / (1024 * 1024));
                     exit(1);
                 }
                 break;
@@ -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/
#2 lore raw
In reply to a message not in the archive

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

Quoted 9 lines · Glauber de Oliveira Costa
qemu/vl.c +1 -1
@@ -8246,7 +8246,7 @@ int main(int argc, char **argv)
                     help(1);
                 if (ram_size > PHYS_RAM_MAX_SIZE) {
                     fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n",
-                            PHYS_RAM_MAX_SIZE / (1024 * 1024));
+                            (int)PHYS_RAM_MAX_SIZE / (1024 * 1024));
                     exit(1);
                 }
                 break;

Ok, this is the wrong version. The above diff is bogus. I'll resend a new one.

Signature · 10 lines
Glauber de Oliveira Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."

-------------------------------------------------------------------------
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/