[RFC,spice-gtk] spice-session: Fix SWAP_STR macro

Submitted by Frediano Ziglio on Sept. 5, 2019, 1:17 p.m.

Details

Message ID 20190905131707.7394-1-fziglio@redhat.com
State Accepted
Commit efc284ec6fdbb5f75af5c7798d50eaf8177b649e
Headers show
Series "spice-session: Fix SWAP_STR macro" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Sept. 5, 2019, 1:17 p.m.
Really swap "x" and "y", not temporary copies.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 src/spice-session.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

I didn't test. The main question is why the current code is working?
Or is migration broken? Or we are not testing the type of migration
the original swapping code (manual) was supposed to make it work?

Patch hide | download patch | download mbox

diff --git a/src/spice-session.c b/src/spice-session.c
index 04ba124a..d0d9e541 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -1742,12 +1742,9 @@  void spice_session_switching_disconnect(SpiceSession *self)
 }
 
 #define SWAP_STR(x, y) G_STMT_START { \
-    const gchar *tmp;                 \
-    const gchar *a = x;               \
-    const gchar *b = y;               \
-    tmp = a;                          \
-    a = b;                            \
-    b = tmp;                          \
+    gchar *tmp = x;                   \
+    x = y;                            \
+    y = tmp;                          \
 } G_STMT_END
 
 G_GNUC_INTERNAL

Comments