+2008-06-15 Naohiro Aota <nao.aota@gmail.com> (tiny change)
+
+ * fontset.c (fontset_pattern_regexp): Escape `+' characters in
+ pattern.
+
2008-06-15 Andreas Schwab <schwab@suse.de>
* font.c (font_update_drivers): Fix crash when no drivers match.
{
/* We must at first update the cached data. */
unsigned char *regex, *p0, *p1;
- int ndashes = 0, nstars = 0;
+ int ndashes = 0, nstars = 0, nplus = 0;
for (p0 = SDATA (pattern); *p0; p0++)
{
ndashes++;
else if (*p0 == '*')
nstars++;
+ else if (*p0 == '+')
+ nplus++;
}
/* If PATTERN is not full XLFD we conert "*" to ".*". Otherwise
we convert "*" to "[^-]*" which is much faster in regular
expression matching. */
if (ndashes < 14)
- p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 1);
+ p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 2 * nplus + 1);
else
- p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 1);
+ p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 2 * nplus + 1);
*p1++ = '^';
for (p0 = SDATA (pattern); *p0; p0++)
}
else if (*p0 == '?')
*p1++ = '.';
+ else if (*p0 == '+')
+ *p1++ = '\\', *p1++ = '+';
else
*p1++ = *p0;
}