aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2010-03-03 22:52:35 +0800
committerXavier Claessens <xclaesse@gmail.com>2010-03-03 23:18:45 +0800
commite99f234b1e90869d04a17e300662b4be8c353bfe (patch)
tree3f4e8d5e2e166b2246aea2fcceb31ae6aec1a45e /libempathy-gtk
parentf48b89ce4d61d16843361636ad9f155451fde98d (diff)
downloadgsoc2013-empathy-e99f234b1e90869d04a17e300662b4be8c353bfe.tar
gsoc2013-empathy-e99f234b1e90869d04a17e300662b4be8c353bfe.tar.gz
gsoc2013-empathy-e99f234b1e90869d04a17e300662b4be8c353bfe.tar.bz2
gsoc2013-empathy-e99f234b1e90869d04a17e300662b4be8c353bfe.tar.lz
gsoc2013-empathy-e99f234b1e90869d04a17e300662b4be8c353bfe.tar.xz
gsoc2013-empathy-e99f234b1e90869d04a17e300662b4be8c353bfe.tar.zst
gsoc2013-empathy-e99f234b1e90869d04a17e300662b4be8c353bfe.zip
Move empathy_uri_regex_dup_singleton to be private inside empathy-string-parser.c
Now that our code is correctly factored, that regex can be made private
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-string-parser.c25
-rw-r--r--libempathy-gtk/empathy-ui-utils.c23
-rw-r--r--libempathy-gtk/empathy-ui-utils.h1
3 files changed, 24 insertions, 25 deletions
diff --git a/libempathy-gtk/empathy-string-parser.c b/libempathy-gtk/empathy-string-parser.c
index 9d0163e8e..27421eb59 100644
--- a/libempathy-gtk/empathy-string-parser.c
+++ b/libempathy-gtk/empathy-string-parser.c
@@ -25,6 +25,29 @@
#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;
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index a2865bc55..927b63eae 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -50,16 +50,6 @@
#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,
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index e03ec66f8..05033f30f 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -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,