/[emacs]/emacs/src/fontset.c
ViewVC logotype

Diff of /emacs/src/fontset.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.77.4.22 by handa, Sat Oct 23 01:35:24 2004 UTC revision 1.77.4.23 by miles, Wed Oct 27 05:42:01 2004 UTC
# Line 1069  fontset_pattern_regexp (pattern) Line 1069  fontset_pattern_regexp (pattern)
1069        || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))        || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))
1070      {      {
1071        /* We must at first update the cached data.  */        /* We must at first update the cached data.  */
1072        char *regex = (char *) alloca (SCHARS (pattern) * 2 + 3);        char *regex, *p0, *p1;
1073        char *p0, *p1 = regex;        int ndashes = 0, nstars = 0;
1074          
1075          for (p0 = SDATA (pattern); *p0; p0++)
1076            {
1077              if (*p0 == '-')
1078                ndashes++;
1079              else if (*p0 == '*')
1080                nstars++;
1081            }
1082    
1083          /* If PATTERN is not full XLFD we conert "*" to ".*".  Otherwise
1084             we convert "*" to "[^-]*" which is much faster in regular
1085             expression matching.  */
1086          if (ndashes < 14)
1087            p1 = regex = (char *) alloca (SBYTES (pattern) + 2 * nstars + 1);
1088          else
1089            p1 = regex = (char *) alloca (SBYTES (pattern) + 5 * nstars + 1);
1090    
       /* Convert "*" to ".*", "?" to ".".  */  
1091        *p1++ = '^';        *p1++ = '^';
1092        for (p0 = (char *) SDATA (pattern); *p0; p0++)        for (p0 = (char *) SDATA (pattern); *p0; p0++)
1093          {          {
1094            if (*p0 == '*')            if (*p0 == '*')
1095              {              {
1096                *p1++ = '.';                if (ndashes < 14)
1097                    *p1++ = '.';
1098                  else
1099                    *p1++ = '[', *p1++ = '^', *p1++ = '-', *p1++ = ']';
1100                *p1++ = '*';                *p1++ = '*';
1101              }              }
1102            else if (*p0 == '?')            else if (*p0 == '?')

Legend:
Removed from v.1.77.4.22  
changed lines
  Added in v.1.77.4.23

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26