diff options
Diffstat (limited to 'src/fontset.c')
| -rw-r--r-- | src/fontset.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/fontset.c b/src/fontset.c index 0c50be2d21e..f370f2ae981 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -790,14 +790,14 @@ fontset_pattern_regexp (pattern) | |||
| 790 | || strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) | 790 | || strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) |
| 791 | { | 791 | { |
| 792 | /* We must at first update the cached data. */ | 792 | /* We must at first update the cached data. */ |
| 793 | char *regex, *p0, *p1; | 793 | unsigned char *regex, *p0, *p1; |
| 794 | int ndashes = 0, nstars = 0; | 794 | int ndashes = 0, nstars = 0; |
| 795 | 795 | ||
| 796 | for (p0 = SDATA (pattern); *p0; p0++) | 796 | for (p0 = SDATA (pattern); *p0; p0++) |
| 797 | { | 797 | { |
| 798 | if (*p0 == '-') | 798 | if (*p0 == '-') |
| 799 | ndashes++; | 799 | ndashes++; |
| 800 | else if (*p0 == '*') | 800 | else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') |
| 801 | nstars++; | 801 | nstars++; |
| 802 | } | 802 | } |
| 803 | 803 | ||
| @@ -805,14 +805,14 @@ fontset_pattern_regexp (pattern) | |||
| 805 | we convert "*" to "[^-]*" which is much faster in regular | 805 | we convert "*" to "[^-]*" which is much faster in regular |
| 806 | expression matching. */ | 806 | expression matching. */ |
| 807 | if (ndashes < 14) | 807 | if (ndashes < 14) |
| 808 | p1 = regex = (char *) alloca (SBYTES (pattern) + 2 * nstars + 1); | 808 | p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 1); |
| 809 | else | 809 | else |
| 810 | p1 = regex = (char *) alloca (SBYTES (pattern) + 5 * nstars + 1); | 810 | p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 1); |
| 811 | 811 | ||
| 812 | *p1++ = '^'; | 812 | *p1++ = '^'; |
| 813 | for (p0 = (char *) SDATA (pattern); *p0; p0++) | 813 | for (p0 = SDATA (pattern); *p0; p0++) |
| 814 | { | 814 | { |
| 815 | if (*p0 == '*') | 815 | if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') |
| 816 | { | 816 | { |
| 817 | if (ndashes < 14) | 817 | if (ndashes < 14) |
| 818 | *p1++ = '.'; | 818 | *p1++ = '.'; |