[virt-viewer] Don't use C99 for loops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Declaring a local variable as part as a for loop
such as 'for (unsigned int i; i < N; i++)' is a C99 specific feature.
Running configure with --enable-compile-warnings=minimal does not add
-std=c99 to the compile flags, so it's better if the codebase does not
require C99 support from the compiler.
---
 src/virt-viewer-session.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
index 20d5fb1..b600481 100644
--- a/src/virt-viewer-session.c
+++ b/src/virt-viewer-session.c
@@ -395,13 +395,14 @@ virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession* self,
     gboolean all_fullscreen = TRUE;
     guint nmonitors = 0;
     GdkRectangle *monitors = NULL;
+    GList *l;
 
     klass = VIRT_VIEWER_SESSION_GET_CLASS(self);
     if (!klass->apply_monitor_geometry)
         return;
 
     /* find highest monitor ID so we can create the sparse array */
-    for (GList *l = self->priv->displays; l; l = l->next) {
+    for (l = self->priv->displays; l; l = l->next) {
         VirtViewerDisplay *d = VIRT_VIEWER_DISPLAY(l->data);
         guint nth = 0;
         g_object_get(d, "nth-display", &nth, NULL);
@@ -410,7 +411,7 @@ virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession* self,
     }
 
     monitors = g_new0(GdkRectangle, nmonitors);
-    for (GList *l = self->priv->displays; l; l = l->next) {
+    for (l = self->priv->displays; l; l = l->next) {
         VirtViewerDisplay *d = VIRT_VIEWER_DISPLAY(l->data);
         guint nth = 0;
         GdkRectangle *rect = NULL;
-- 
1.9.3

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux