[Xfce4-commits] <tumbler:master> Optimize regex patterns for cover thumbnailer.

Nick Schermer noreply at xfce.org
Thu Dec 27 11:30:14 CET 2012


Updating branch refs/heads/master
         to a1daaeeba2ec8ae075eacff6d95c2e301e5d3003 (commit)
       from 8002e0913ac1bb8f21153fbe6f06be9ad9453a7b (commit)

commit a1daaeeba2ec8ae075eacff6d95c2e301e5d3003
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Dec 18 20:51:42 2012 +0100

    Optimize regex patterns for cover thumbnailer.
    
    Use multiple times, so worth spending time on.

 plugins/cover-thumbnailer/cover-thumbnailer.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/plugins/cover-thumbnailer/cover-thumbnailer.c b/plugins/cover-thumbnailer/cover-thumbnailer.c
index cb3d708..4ff7756 100644
--- a/plugins/cover-thumbnailer/cover-thumbnailer.c
+++ b/plugins/cover-thumbnailer/cover-thumbnailer.c
@@ -123,11 +123,12 @@ static void
 cover_thumbnailer_init (CoverThumbnailer *thumbnailer)
 {
   GKeyFile *rc;
+  GRegexCompileFlags rcflags = G_REGEX_CASELESS | G_REGEX_OPTIMIZE;
 
   /* prepare the regular expressions */
-  thumbnailer->series_regex = g_regex_new (SERIES_PATTERN, G_REGEX_CASELESS, 0, NULL);
-  thumbnailer->abbrev_regex = g_regex_new (ABBREV_PATTERN, G_REGEX_CASELESS, 0, NULL);
-  thumbnailer->year_regex = g_regex_new (YEAR_PATTERN, 0, 0, NULL);
+  thumbnailer->series_regex = g_regex_new (SERIES_PATTERN, rcflags, 0, NULL);
+  thumbnailer->abbrev_regex = g_regex_new (ABBREV_PATTERN, rcflags, 0, NULL);
+  thumbnailer->year_regex = g_regex_new (YEAR_PATTERN, rcflags, 0, NULL);
 
   /* curl dns share */
   thumbnailer->curl_multi = curl_multi_init ();


More information about the Xfce4-commits mailing list