vnc: Drop some superfluous conditionals
v2 cover vnc: Drop some superfluous conditionals
Markus Armbruster (2):
vnc: Drop superfluous conditionals around g_free()
vnc: Drop superfluous conditionals around g_strdup()
ui/vnc-tls.c | 6 ++---- ui/vnc.c | 15 ++++----------- 2 files changed, 6 insertions(+), 15 deletions(-)
Signature · 1 line
1.9.3
PATCH v2 1/2 vnc: Drop superfluous conditionals around g_free()
--- ui/vnc-tls.c | 6 ++---- ui/vnc.c | 12 ++++-------- 2 files changed, 6 insertions(+), 12 deletions(-)
ui/vnc-tls.c +2 -4
@@ -443,10 +443,8 @@ static int vnc_set_x509_credential(VncDisplay *vd, {struct stat sb; -if (*cred) { -g_free (*cred); - *cred =NULL ; - } +g_free (*cred); + *cred =NULL ; *cred =g_malloc (strlen (certdir) +strlen (filename) +2 );
ui/vnc.c +4 -8
@@ -2972,10 +2972,8 @@ static void vnc_display_close(DisplayState *ds)if (!vs)return ; -if (vs->display) { -g_free (vs->display); - vs->display =NULL ; - } +g_free (vs->display); + vs->display =NULL ;if (vs->lsock !=-1 ) {qemu_set_fd_handler2 (vs->lsock,NULL ,NULL ,NULL ,NULL );close (vs->lsock);
@@ -3010,10 +3008,8 @@ int vnc_display_password(DisplayState *ds, const char *password)return -EINVAL ; } -if (vs->password) { -g_free (vs->password); - vs->password =NULL ; - } +g_free (vs->password); + vs->password =NULL ;if (password) { vs->password =g_strdup (password); }
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH v2 1/2] vnc: Drop superfluous conditionals around g_free()
Quoted 12 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- ui/vnc-tls.c | 6 ++---- ui/vnc.c | 12 ++++-------- 2 files changed, 6 insertions(+), 12 deletions(-)ui/vnc-tls.c +0
-0@@ -443,10 +443,8 @@ static int vnc_set_x509_credential(VncDisplay *vd, {
ui/vnc-tls.c static int vnc_set_x509_credential(VncDisplay *vd, · line 449
Quoted 10 lines
ui/vnc-tls.c +2
-4struct stat sb; -if (*cred) { -g_free (*cred); - *cred =NULL ; - } +g_free (*cred); + *cred =NULL ; *cred =g_malloc (strlen (certdir) +strlen (filename) +2 );
Still a dead store
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH v2 1/2] vnc: Drop superfluous conditionals around g_free()
Quoted 22 lines · Eric Blake
Quoted 21 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- ui/vnc-tls.c | 6 ++---- ui/vnc.c | 12 ++++-------- 2 files changed, 6 insertions(+), 12 deletions(-)ui/vnc-tls.c +2
-4@@ -443,10 +443,8 @@ static int vnc_set_x509_credential(VncDisplay *vd, {struct stat sb; -if (*cred) { -g_free (*cred); - *cred =NULL ; - } +g_free (*cred); + *cred =NULL ;
Quoted 3 lines
ui/vnc-tls.c static int vnc_set_x509_credential(VncDisplay *vd, · line 449
Quoted 1 line
ui/vnc-tls.c +0
-0*cred =g_malloc (strlen (certdir) +strlen (filename) +2 );Still a dead store
No deader than before my patch :)
Still, it's as good an opportunity to drop it as any. Gerd, would you like a v3?
Re: [Qemu-devel] [PATCH v2 1/2] vnc: Drop superfluous conditionals around g_free()
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
+ *cred = NULL;
*cred = g_malloc(strlen(certdir) + strlen(filename) + 2);Still a dead store
No deader than before my patch :)
Still, it's as good an opportunity to drop it as any. Gerd, would you like a v3?
It's an improvement in any case, so I'm not going to reject it. Nevertheless a v3 would be nice though.
cheers,
Gerd
PATCH v2 2/2 vnc: Drop superfluous conditionals around g_strdup()
In reply to Markus Armbruster--- ui/vnc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
ui/vnc.c +1 -4
@@ -3009,10 +3009,7 @@ int vnc_display_password(DisplayState *ds, const char *password) }g_free (vs->password); - vs->password =NULL ; -if (password) { - vs->password =g_strdup (password); - } + vs->password =g_strdup (password);return 0 ; }
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH v2 2/2] vnc: Drop superfluous conditionals around g_strdup()
Quoted 4 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- ui/vnc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 8 lines · Markus Armbruster
Markus Armbruster (2):
vnc: Drop superfluous conditionals aroundg_free()
vnc: Drop superfluous conditionals aroundg_strdup()ui/vnc-tls.c | 6 ++---- ui/vnc.c | 15 ++++----------- 2 files changed, 6 insertions(+), 15 deletions(-)
Picked them up.
thanks,
Gerd
Quoted 10 lines · Gerd Hoffmann
Quoted 8 lines · Markus Armbruster
Markus Armbruster (2):
vnc: Drop superfluous conditionals aroundg_free()
vnc: Drop superfluous conditionals aroundg_strdup()ui/vnc-tls.c | 6 ++---- ui/vnc.c | 15 ++++----------- 2 files changed, 6 insertions(+), 15 deletions(-)Picked them up.
Thanks!
I'll drop the dead store Eric noted in a followup patch, unless you squash it in (fine with me).