[vd_agent_linux,1/5] x11-randr: Avoid passing XEvent as value

Submitted by Frediano Ziglio on July 24, 2019, 8:21 a.m.

Details

Message ID 20190724082132.6163-2-fziglio@redhat.com
State Accepted
Headers show
Series "Minor patches for analyzers tools" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio July 24, 2019, 8:21 a.m.
The structure is not that small and is not necessary to copy
the value.
This also removed a Coverity warning.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 src/vdagent/x11-priv.h  | 2 +-
 src/vdagent/x11-randr.c | 8 ++++----
 src/vdagent/x11.c       | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/vdagent/x11-priv.h b/src/vdagent/x11-priv.h
index 99676d2..730b9b3 100644
--- a/src/vdagent/x11-priv.h
+++ b/src/vdagent/x11-priv.h
@@ -152,7 +152,7 @@  void vdagent_x11_send_daemon_guest_xorg_res(struct vdagent_x11 *x11,
 void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
                                             int screen, int width, int height);
 int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
-    XEvent event);
+    const XEvent *event);
 void vdagent_x11_set_error_handler(struct vdagent_x11 *x11,
     int (*handler)(Display *, XErrorEvent *));
 int vdagent_x11_restore_error_handler(struct vdagent_x11 *x11);
diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
index 4b022d6..3fb7a68 100644
--- a/src/vdagent/x11-randr.c
+++ b/src/vdagent/x11-randr.c
@@ -529,14 +529,14 @@  void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
 }
 
 int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
-    XEvent event)
+    const XEvent *event)
 {
     int handled = TRUE;
 
-    switch (event.type - x11->xrandr_event_base) {
+    switch (event->type - x11->xrandr_event_base) {
         case RRScreenChangeNotify: {
-            XRRScreenChangeNotifyEvent *sce =
-                (XRRScreenChangeNotifyEvent *) &event;
+            const XRRScreenChangeNotifyEvent *sce =
+                (const XRRScreenChangeNotifyEvent *) event;
             vdagent_x11_randr_handle_root_size_change(x11, 0,
                 sce->width, sce->height);
             break;
diff --git a/src/vdagent/x11.c b/src/vdagent/x11.c
index c2515a8..61d7c69 100644
--- a/src/vdagent/x11.c
+++ b/src/vdagent/x11.c
@@ -545,7 +545,7 @@  static void vdagent_x11_handle_event(struct vdagent_x11 *x11, XEvent event)
     }
 #endif
 
-    if (vdagent_x11_randr_handle_event(x11, event))
+    if (vdagent_x11_randr_handle_event(x11, &event))
         return;
 
     switch (event.type) {