[devhelp/wip/swilmet/misc-improvements] keyword-model: use strchr() instead of g_strrstr()



commit 952106ebeb59357c4fb7763eaaec5d9c77decec2
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun May 31 09:05:05 2015 +0200

    keyword-model: use strchr() instead of g_strrstr()
    
    g_strrstr() searches the last occurrence, while strchr() searches the
    first occurrence. Since we are only interested to know whether there is
    (at least) one occurrence, we can use strchr() (small optimization).

 src/dh-keyword-model.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/dh-keyword-model.c b/src/dh-keyword-model.c
index 3df2ebf..7f04ff3 100644
--- a/src/dh-keyword-model.c
+++ b/src/dh-keyword-model.c
@@ -380,8 +380,8 @@ dh_globbed_keywords_new (GStrv keywords)
                 data = g_slice_new (DhKeywordGlobPattern);
                 data->keyword = keywords[i];
 
-                if (g_strrstr (keywords[i], "*") != NULL ||
-                    g_strrstr (keywords[i], "?") != NULL) {
+                if (strchr (keywords[i], '*') != NULL ||
+                    strchr (keywords[i], '?') != NULL) {
                         gchar *glob;
 
                         data->has_glob = TRUE;


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