mirror of
https://github.com/irssi/irssi.git
synced 2026-08-22 10:02:22 +02:00
Merge 01adadf8a9 into 29f27cfb39
This commit is contained in:
commit
1aac123f9a
1 changed files with 6 additions and 5 deletions
|
|
@ -728,16 +728,17 @@ int expand_escape(const char **data)
|
||||||
char *escape_string(const char *str, const char *what)
|
char *escape_string(const char *str, const char *what)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
char *ret;
|
char *ret, *escaped;
|
||||||
|
|
||||||
ret = g_malloc(strlen(str) * 2 + 1);
|
ret = g_malloc(strlen(str) * 2 + 1);
|
||||||
for (p = str; *p != '\0'; p++, ret++) {
|
escaped = ret;
|
||||||
|
for (p = str; *p != '\0'; p++, escaped++) {
|
||||||
if (strchr(what, *p) != NULL) {
|
if (strchr(what, *p) != NULL) {
|
||||||
*ret++ = '\\';
|
*escaped++ = '\\';
|
||||||
}
|
}
|
||||||
*ret = *p;
|
*escaped = *p;
|
||||||
}
|
}
|
||||||
*ret = '\0';
|
*escaped = '\0';
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue