util: Wrap g_regex_escape_string()

This commit is contained in:
Florian Müllner 2017-06-23 20:12:38 +02:00
parent 150252391f
commit bcec9f35d5
2 changed files with 17 additions and 0 deletions

View File

@ -240,6 +240,21 @@ shell_util_translate_time_string (const char *str)
return res;
}
/**
* shell_util_regex_escape:
* @str: a UTF-8 string to escape
*
* A wrapper around g_regex_escape_string() that takes its argument as
* \0-terminated string rather than a byte-array the confuses gjs.
*
* Returns: @str with all regex-special characters escaped
*/
char *
shell_util_regex_escape (const char *str)
{
return g_regex_escape_string (str, -1);
}
/**
* shell_write_string_to_stream:
* @stream: a #GOutputStream

View File

@ -24,6 +24,8 @@ char *shell_util_format_date (const char *format,
gint64 time_ms);
const char *shell_util_translate_time_string (const char *str);
char *shell_util_regex_escape (const char *str);
gboolean shell_write_string_to_stream (GOutputStream *stream,
const char *str,
GError **error);