[ekiga] Use a GRegex instead of PString's replace (hence using the same regex during the whole loop)
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Use a GRegex instead of PString's replace (hence using the same regex during the whole loop)
- Date: Sun, 13 Jan 2013 21:57:31 +0000 (UTC)
commit 899f9fc6217e18bfe28bf70e2fb5083fcbeed214
Author: Julien Puydt <jpuydt free fr>
Date: Sun Jan 13 22:25:10 2013 +0100
Use a GRegex instead of PString's replace (hence using the same regex during the whole loop)
src/gui/conf.cpp | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/conf.cpp b/src/gui/conf.cpp
index 14a9eb7..8202b9c 100644
--- a/src/gui/conf.cpp
+++ b/src/gui/conf.cpp
@@ -119,14 +119,22 @@ gnomemeeting_conf_upgrade ()
/* diamondcard is now set at sip.diamondcard.us */
GSList *accounts = gm_conf_get_string_list ("/apps/" PACKAGE_NAME "/protocols/accounts_list");
GSList *accounts_iter = accounts;
+ GRegex* regex = g_regex_new ("eugw\\.ast\\.diamondcard\\.us",
+ (GRegexCompileFlags)0,
+ (GRegexMatchFlags)0,
+ NULL);
+ gchar* replaced_acct = NULL;
while (accounts_iter) {
- PString acct = (gchar *) accounts_iter->data;
- acct.Replace ("eugw.ast.diamondcard.us", "sip.diamondcard.us", TRUE);
+ replaced_acct = g_regex_replace (regex, (gchar *) accounts_iter->data,
+ -1, 0, "sip.diamondcard.us",
+ (GRegexMatchFlags)0, NULL);
g_free (accounts_iter->data);
- accounts_iter->data = g_strdup ((const char *) acct);
+ accounts_iter->data = replaced_acct;
accounts_iter = g_slist_next (accounts_iter);
}
+ g_regex_unref (regex);
+
gm_conf_set_string_list ("/apps/" PACKAGE_NAME "/protocols/accounts_list", accounts);
g_slist_foreach (accounts, (GFunc) g_free, NULL);
g_slist_free (accounts);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]