* [Qemu-devel] [PATCH] qemu-ga: remove useless allocation
@ 2017-05-26 10:13 Marc-André Lureau
2017-05-26 13:38 ` Eric Blake
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Marc-André Lureau @ 2017-05-26 10:13 UTC (permalink / raw)
To: qemu-devel; +Cc: Marc-André Lureau, qemu-trivial, Michael Roth
There is no need to duplicate a fixed string.
CC: qemu-trivial@nongnu.org
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
qga/commands-posix.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 284ecc6d7e..d8e412275e 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -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 =
--
2.13.0.rc1.16.gd80b50c3f
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-ga: remove useless allocation
2017-05-26 10:13 [Qemu-devel] [PATCH] qemu-ga: remove useless allocation Marc-André Lureau
@ 2017-05-26 13:38 ` Eric Blake
2017-05-26 19:35 ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
2017-06-01 9:47 ` [Qemu-devel] " Michael Tokarev
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2017-05-26 13:38 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: qemu-trivial, Michael Roth
[-- Attachment #1: Type: text/plain, Size: 477 bytes --]
On 05/26/2017 05:13 AM, Marc-André Lureau wrote:
> There is no need to duplicate a fixed string.
>
> CC: qemu-trivial@nongnu.org
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> qga/commands-posix.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH] qemu-ga: remove useless allocation
2017-05-26 10:13 [Qemu-devel] [PATCH] qemu-ga: remove useless allocation Marc-André Lureau
2017-05-26 13:38 ` Eric Blake
@ 2017-05-26 19:35 ` Philippe Mathieu-Daudé
2017-06-01 9:47 ` [Qemu-devel] " Michael Tokarev
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-05-26 19:35 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: qemu-trivial
On 05/26/2017 07:13 AM, Marc-André Lureau wrote:
> There is no need to duplicate a fixed string.
>
> CC: qemu-trivial@nongnu.org
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> qga/commands-posix.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index 284ecc6d7e..d8e412275e 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -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 =
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-ga: remove useless allocation
2017-05-26 10:13 [Qemu-devel] [PATCH] qemu-ga: remove useless allocation Marc-André Lureau
2017-05-26 13:38 ` Eric Blake
2017-05-26 19:35 ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
@ 2017-06-01 9:47 ` Michael Tokarev
2 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2017-06-01 9:47 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: qemu-trivial
26.05.2017 13:13, Marc-André Lureau wrote:
> There is no need to duplicate a fixed string.
Applied to -trivial, thanks!
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-01 9:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26 10:13 [Qemu-devel] [PATCH] qemu-ga: remove useless allocation Marc-André Lureau
2017-05-26 13:38 ` Eric Blake
2017-05-26 19:35 ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
2017-06-01 9:47 ` [Qemu-devel] " Michael Tokarev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.