summaryrefslogtreecommitdiff
path: root/main/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/utils.c')
-rw-r--r--main/utils.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/main/utils.c b/main/utils.c
index ba646c44b..229080b83 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -483,6 +483,29 @@ char *ast_escape_quoted(const char *string, char *outbuf, int buflen)
return outbuf;
}
+
+void ast_unescape_quoted(char *quote_str)
+{
+ int esc_pos;
+ int unesc_pos;
+ int quote_str_len = strlen(quote_str);
+
+ for (esc_pos = 0, unesc_pos = 0;
+ esc_pos < quote_str_len;
+ esc_pos++, unesc_pos++) {
+ if (quote_str[esc_pos] == '\\') {
+ /* at least one more char and current is \\ */
+ esc_pos++;
+ if (esc_pos >= quote_str_len) {
+ break;
+ }
+ }
+
+ quote_str[unesc_pos] = quote_str[esc_pos];
+ }
+ quote_str[unesc_pos] = '\0';
+}
+
int ast_xml_escape(const char *string, char * const outbuf, const size_t buflen)
{
char *dst = outbuf;