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

Nick Schermer noreply at xfce.org
Tue Dec 18 20:54:01 CET 2012


Updating branch refs/heads/nick/cover-thumbnailer
         to b8bf36f42de59d2c665a5ce2d21e578fd8b9cb3a (commit)
       from a8008430c2ad78230b55e4358c1286b2505e7d12 (commit)

commit b8bf36f42de59d2c665a5ce2d21e578fd8b9cb3a
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