+static FcChar8 *
+cescape (const FcChar8 *str)
+{
+ FcStrBuf buf;
+ FcChar8 buf_static[8192];
+
+ FcStrBufInit (&buf, buf_static, sizeof (buf_static));
+ while(*str)
+ {
+ switch (*str)
+ {
+ case '\\':
+ case '"':
+ FcStrBufChar (&buf, '\\');
+ break;
+ }
+ FcStrBufChar (&buf, *str++);
+ }
+ return FcStrBufDone (&buf);
+}
+
+static FcChar8 *
+shescape (const FcChar8 *str)
+{
+ FcStrBuf buf;
+ FcChar8 buf_static[8192];
+
+ FcStrBufInit (&buf, buf_static, sizeof (buf_static));
+ FcStrBufChar (&buf, '\'');
+ while(*str)
+ {
+ if (*str == '\'')
+ FcStrBufString (&buf, (const FcChar8 *) "'\\''");
+ else
+ FcStrBufChar (&buf, *str);
+ str++;
+ }
+ FcStrBufChar (&buf, '\'');
+ return FcStrBufDone (&buf);
+}
+
+static FcChar8 *
+xmlescape (const FcChar8 *str)
+{
+ FcStrBuf buf;
+ FcChar8 buf_static[8192];
+
+ FcStrBufInit (&buf, buf_static, sizeof (buf_static));
+ while(*str)
+ {
+ switch (*str)
+ {
+ case '&': FcStrBufString (&buf, (const FcChar8 *) "&"); break;
+ case '<': FcStrBufString (&buf, (const FcChar8 *) "<"); break;
+ case '>': FcStrBufString (&buf, (const FcChar8 *) ">"); break;
+ default: FcStrBufChar (&buf, *str); break;
+ }
+ str++;
+ }
+ return FcStrBufDone (&buf);
+}
+