qemu-ga: remove useless allocation
PATCH 1/1 qemu-ga: remove useless allocation
There is no need to duplicate a fixed string.
Signed-off-by Marc-André Lureau <[email protected]>
--- qga/commands-posix.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
qga/commands-posix.c +1 -3
@@ -2197,12 +2197,10 @@ static void transfer_memory_block(GuestMemoryBlock *mem_blk, bool sys2memblk, } }else {if (mem_blk->online != (strncmp (status,"online" ,6 ) ==0 )) { -char *new_state = mem_blk->online ?g_strdup ("online" ) : -g_strdup ("offline" ); +const char *new_state = mem_blk->online ?"online" :"offline" ;ga_write_sysfs_file (dirfd,"state" , new_state,strlen (new_state), &local_err); -g_free (new_state);if (local_err) {error_free (local_err); result->response =
Signature · 1 line
2.13.0.rc1.16.gd80b50c3f
Quoted 8 lines · Marc-André Lureau
There is no need to duplicate a fixed string.
Signed-off-by Marc-André Lureau <[email protected]>--- qga/commands-posix.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Reviewed-by Eric Blake <[email protected]>
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 4 lines · Marc-André Lureau
There is no need to duplicate a fixed string.
Signed-off-by Marc-André Lureau <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 23 lines
--- qga/commands-posix.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)qga/commands-posix.c +1
-3@@ -2197,12 +2197,10 @@ static void transfer_memory_block(GuestMemoryBlock *mem_blk, bool sys2memblk, } }else {if (mem_blk->online != (strncmp (status,"online" ,6 ) ==0 )) { -char *new_state = mem_blk->online ?g_strdup ("online" ) : -g_strdup ("offline" ); +const char *new_state = mem_blk->online ?"online" :"offline" ;ga_write_sysfs_file (dirfd,"state" , new_state,strlen (new_state), &local_err); -g_free (new_state);if (local_err) {error_free (local_err); result->response =
Michael Tokarev
AppliedQuoted 1 line · Marc-André Lureau
There is no need to duplicate a fixed string.
Applied to -trivial, thanks!
/mjt