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



commit 732e2bcd94ef5b45cf92d6063fa7593f7ddc4768
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.

 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]