[devhelp/wip/swilmet/misc-improvements: 2/9] keyword-model: don't loop to get a non-zero stamp



commit 91c11bcb8affeea9f4d2d9265c36b7e86e41cf22
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat May 30 14:42:41 2015 +0200

    keyword-model: don't loop to get a non-zero stamp
    
    Take a stamp only in the positive range. Excluding negative numbers
    should not be a problem.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749797

 src/dh-keyword-model.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
---
diff --git a/src/dh-keyword-model.c b/src/dh-keyword-model.c
index 60a9ac0..3314826 100644
--- a/src/dh-keyword-model.c
+++ b/src/dh-keyword-model.c
@@ -93,9 +93,7 @@ dh_keyword_model_init (DhKeywordModel *model)
 {
         DhKeywordModelPrivate *priv = dh_keyword_model_get_instance_private (model);
 
-        do {
-                priv->stamp = g_random_int ();
-        } while (priv->stamp == 0);
+        priv->stamp = g_random_int_range (1, G_MAXINT32);
 }
 
 static GtkTreeModelFlags


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