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

Christophe Fergeau cfergeau at redhat.com
Tue Jun 24 07:50:29 UTC 2014


Ping?

On Fri, Jun 13, 2014 at 04:05:38PM +0200, Christophe Fergeau wrote:
> 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 at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20140624/70937e52/attachment.sig>


More information about the virt-tools-list mailing list