Skip to contentSkip to conversation

Remove clone-and-hack code from qemu-img

PATCH In review Ian Jackson 1 participant 2 messages Jan 25, 2008 – Feb 6, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove clone-and-hack code from qemu-img

qemu-img.c has copies of qemu_malloc et al, which are already provided in osdep.c. The attached patch removes these from qemu-img.c and adds osdep.o to BLOCK_OBJS.

(It wants to be in BLOCK_OBJS rather than just in qemu-img to support my next patch.)

Regards,
Ian.

Index: Makefile
===================================================================
RCS file: /sources/qemu/qemu/Makefile,v
retrieving revision 1.143

Makefile +1 -1
diff -u -r1.143 Makefile
@@ -37,7 +37,7 @@
 #######################################################################
 # BLOCK_OBJS is code used by both qemu system emulation and qemu-img
 
-BLOCK_OBJS=cutils.o
+BLOCK_OBJS=cutils.o osdep.o
 BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
 BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
 BLOCK_OBJS+=block-qcow2.o block-parallels.o

Index: qemu-img.c
===================================================================
RCS file: /sources/qemu/qemu/qemu-img.c,v
retrieving revision 1.28

qemu-img.c +0 -35
diff -u -r1.28 qemu-img.c
@@ -30,41 +30,6 @@
 #include <windows.h>
 #endif
 
-void *get_mmap_addr(unsigned long size)
-{
-    return NULL;
-}
-
-void qemu_free(void *ptr)
-{
-    free(ptr);
-}
-
-void *qemu_malloc(size_t size)
-{
-    return malloc(size);
-}
-
-void *qemu_mallocz(size_t size)
-{
-    void *ptr;
-    ptr = qemu_malloc(size);
-    if (!ptr)
-        return NULL;
-    memset(ptr, 0, size);
-    return ptr;
-}
-
-char *qemu_strdup(const char *str)
-{
-    char *ptr;
-    ptr = qemu_malloc(strlen(str) + 1);
-    if (!ptr)
-        return NULL;
-    strcpy(ptr, str);
-    return ptr;
-}
-
 static void __attribute__((noreturn)) error(const char *fmt, ...)
 {
     va_list ap;
#1 lore raw

iwj writes ("[PATCH] Remove clone-and-hack code from qemu-img"):

Quoted 3 lines

qemu-img.c has copies of qemu_malloc et al, which are already provided in osdep.c. The attached patch removes these from qemu-img.c and adds osdep.o to BLOCK_OBJS.

Is there some reason why this patch has not yet been included in the current CVS ?

Thanks,
Ian.