emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/fontset.c [emacs-unicode-2]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/fontset.c [emacs-unicode-2]
Date: Wed, 27 Oct 2004 02:06:23 -0400

Index: emacs/src/fontset.c
diff -c emacs/src/fontset.c:1.77.4.22 emacs/src/fontset.c:1.77.4.23
*** emacs/src/fontset.c:1.77.4.22       Sat Oct 23 01:35:24 2004
--- emacs/src/fontset.c Wed Oct 27 05:42:01 2004
***************
*** 1069,1084 ****
        || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))
      {
        /* We must at first update the cached data.  */
!       char *regex = (char *) alloca (SCHARS (pattern) * 2 + 3);
!       char *p0, *p1 = regex;
  
-       /* Convert "*" to ".*", "?" to ".".  */
        *p1++ = '^';
        for (p0 = (char *) SDATA (pattern); *p0; p0++)
        {
          if (*p0 == '*')
            {
!             *p1++ = '.';
              *p1++ = '*';
            }
          else if (*p0 == '?')
--- 1069,1102 ----
        || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))
      {
        /* We must at first update the cached data.  */
!       char *regex, *p0, *p1;
!       int ndashes = 0, nstars = 0;
!       
!       for (p0 = SDATA (pattern); *p0; p0++)
!       {
!         if (*p0 == '-')
!           ndashes++;
!         else if (*p0 == '*')
!           nstars++;
!       }
! 
!       /* 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 = (char *) alloca (SBYTES (pattern) + 2 * nstars + 1);
!       else
!       p1 = regex = (char *) alloca (SBYTES (pattern) + 5 * nstars + 1);
  
        *p1++ = '^';
        for (p0 = (char *) SDATA (pattern); *p0; p0++)
        {
          if (*p0 == '*')
            {
!             if (ndashes < 14)
!               *p1++ = '.';
!             else
!               *p1++ = '[', *p1++ = '^', *p1++ = '-', *p1++ = ']';
              *p1++ = '*';
            }
          else if (*p0 == '?')




reply via email to

[Prev in Thread] Current Thread [Next in Thread]