bug-grep
[Top][All Lists]
Advanced

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

Re: Applying outstanding patches [bug-grep]


From: Claudio Fontana
Subject: Re: Applying outstanding patches [bug-grep]
Date: Thu, 14 Apr 2005 17:05:42 +0200 (CEST)

Hello,

--- Charles Levert <address@hidden> wrote:
> * On Wednesday 2005-04-13 at 20:10:41 +0200, Claudio
> Fontana wrote:
> > I would suggest freezing the Red Hat UTF8 speedup
> > patch. I studied it with attention and it
> addresses a
> > real performance problem, but I think it needs
> some
> > restructuring to avoid code dups, and generalize
> some
> > functionality in appropriate functions to be more
> > maintenable in the future.
> 
> I think that, given the current freeze we've
> been in for some time, any motion (not even
> necessarily proven progress) is good

I can agree for the other patches, but the big UTF-8
hack as it is now is going to be more harm than good. 

There is a lot of new code which is sometimes
redundant and generally unstructured.

For example this code:

+#ifdef MBS_SUPPORT
+             if (mb_cur_max > 1 && !using_utf8)
+               {
+                 bytes_left = offset;
+                 while (bytes_left)
+                   {
+                     size_t mlen = mbrlen (beg,
bytes_left, &mbs);
+                     if (mlen == (size_t) -1 || mlen
== 0)
+                       {
+                         /* Incomplete character:
treat as single-byte. */
+                         memset (&mbs, '\0', sizeof
(mbstate_t));
+                         beg++;
+                         bytes_left--;
+                         continue;
+                       }
+
+                     if (mlen == (size_t) -2)
+                       /* Offset points inside
multibyte character:
+                        * no good. */
+                       break;
+
+                     beg += mlen;
+                     bytes_left -= mlen;
+                   }
+               }
+             else
+#endif /* MBS_SUPPORT */

is repeated in the patch three times.
This cries for a helper function
(convert_multibyte_offset ?).

Btw aren't bigger changes planned for future versions
of grep?

Claudio




                
___________________________________ 
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, 
Giochi, Rubrica… Scaricalo ora! 
http://it.messenger.yahoo.it




reply via email to

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