]> git.0d.be Git - empathy.git/commitdiff
Move empathy_uri_regex_dup_singleton to be private inside empathy-string-parser.c
authorXavier Claessens <xclaesse@gmail.com>
Wed, 3 Mar 2010 14:52:35 +0000 (15:52 +0100)
committerXavier Claessens <xclaesse@gmail.com>
Wed, 3 Mar 2010 15:18:45 +0000 (16:18 +0100)
Now that our code is correctly factored, that regex can be made private

libempathy-gtk/empathy-string-parser.c
libempathy-gtk/empathy-ui-utils.c
libempathy-gtk/empathy-ui-utils.h

index 9d0163e8e855b896f0aabfb894ab67e59f0c1887..27421eb59cfd586ba5f2882f1950861484e13e1a 100644 (file)
 #include "empathy-string-parser.h"
 #include "empathy-smiley-manager.h"
 
+#define SCHEMES           "([a-zA-Z\\+]+)"
+#define INVALID_CHARS     "\\s\"'"
+#define INVALID_CHARS_EXT INVALID_CHARS "\\[\\]<>(){},;:?"
+#define BODY              "([^"INVALID_CHARS"]+)"
+#define BODY_END          "([^"INVALID_CHARS"]*)[^"INVALID_CHARS_EXT".]"
+#define BODY_STRICT       "([^"INVALID_CHARS_EXT"]+)"
+#define URI_REGEX         "("SCHEMES"://"BODY_END")" \
+                         "|((www|ftp)\\."BODY_END")" \
+                         "|((mailto:)?"BODY_STRICT"@"BODY"\\."BODY_END")"
+
+static GRegex *
+uri_regex_dup_singleton (void)
+{
+       static GRegex *uri_regex = NULL;
+
+       /* We intentionally leak the regex so it's not recomputed */
+       if (!uri_regex) {
+               uri_regex = g_regex_new (URI_REGEX, 0, 0, NULL);
+       }
+
+       return g_regex_ref (uri_regex);
+}
+
 void
 empathy_string_parser_substr (const gchar *text,
                              gssize len,
@@ -50,7 +73,7 @@ empathy_string_match_link (const gchar *text,
        gboolean    match;
        gint        last = 0;
 
-       uri_regex = empathy_uri_regex_dup_singleton ();
+       uri_regex = uri_regex_dup_singleton ();
        match = g_regex_match_full (uri_regex, text, len, 0, 0, &match_info, NULL);
        if (match) {
                gint s = 0, e = 0;
index a2865bc55d7b883c74759dc2c0f766f167500556..927b63eae24626daddd7bff1d89aaf176ca781f1 100644 (file)
 #include <libempathy/empathy-idle.h>
 #include <libempathy/empathy-ft-factory.h>
 
-#define SCHEMES           "([a-zA-Z\\+]+)"
-#define INVALID_CHARS     "\\s\"'"
-#define INVALID_CHARS_EXT INVALID_CHARS "\\[\\]<>(){},;:?"
-#define BODY              "([^"INVALID_CHARS"]+)"
-#define BODY_END          "([^"INVALID_CHARS"]*)[^"INVALID_CHARS_EXT".]"
-#define BODY_STRICT       "([^"INVALID_CHARS_EXT"]+)"
-#define URI_REGEX         "("SCHEMES"://"BODY_END")" \
-                         "|((www|ftp)\\."BODY_END")" \
-                         "|((mailto:)?"BODY_STRICT"@"BODY"\\."BODY_END")"
-
 void
 empathy_gtk_init (void)
 {
@@ -75,19 +65,6 @@ empathy_gtk_init (void)
        initialized = TRUE;
 }
 
-GRegex *
-empathy_uri_regex_dup_singleton (void)
-{
-       static GRegex *uri_regex = NULL;
-
-       /* We intentionally leak the regex so it's not recomputed */
-       if (!uri_regex) {
-               uri_regex = g_regex_new (URI_REGEX, 0, 0, NULL);
-       }
-
-       return g_regex_ref (uri_regex);
-}
-
 static GtkBuilder *
 builder_get_file_valist (const gchar *filename,
                         const gchar *first_object,
index e03ec66f8bb98ad4e054289112ff2b445f271a94..05033f30f8bc0e4d7a05c08d7f278328bf9944ec 100644 (file)
@@ -47,7 +47,6 @@ G_BEGIN_DECLS
                                            (y) < gdk_screen_height ())
 
 void            empathy_gtk_init                        (void);
-GRegex *        empathy_uri_regex_dup_singleton         (void);
 
 /* Glade */
 GtkBuilder *    empathy_builder_get_file                (const gchar      *filename,