[Asterisk-code-review] sorcery: Use more compatible regex for local expressions. (asterisk[14])

Anonymous Coward asteriskteam at digium.com
Tue Aug 2 11:28:19 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: sorcery: Use more compatible regex for local expressions.
......................................................................


sorcery: Use more compatible regex for local expressions.

This changes the use of an empty regex for both res_sorcery_config
and res_sorcery_memory to "." instead. This is a more compatible
regular expression which also works on FreeBSD.

ASTERISK-26206 #close

Change-Id: Ia9166dd176f1597555ba22b6931180d0626c1388
---
M res/res_sorcery_config.c
M res/res_sorcery_memory.c
2 files changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_sorcery_config.c b/res/res_sorcery_config.c
index dd4ea88..6059a52 100644
--- a/res/res_sorcery_config.c
+++ b/res/res_sorcery_config.c
@@ -210,6 +210,10 @@
 		.regex = &expression,
 	};
 
+	if (ast_strlen_zero(regex)) {
+		regex = ".";
+	}
+
 	if (!config_objects || regcomp(&expression, regex, REG_EXTENDED | REG_NOSUB)) {
 		return;
 	}
diff --git a/res/res_sorcery_memory.c b/res/res_sorcery_memory.c
index db1fc1a..774c955 100644
--- a/res/res_sorcery_memory.c
+++ b/res/res_sorcery_memory.c
@@ -188,6 +188,10 @@
 		.regex = &expression,
 	};
 
+	if (ast_strlen_zero(regex)) {
+		regex = ".";
+	}
+
 	if (regcomp(&expression, regex, REG_EXTENDED | REG_NOSUB)) {
 		return;
 	}

-- 
To view, visit https://gerrit.asterisk.org/3393
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia9166dd176f1597555ba22b6931180d0626c1388
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list