bug-gnulib
[Top][All Lists]
Advanced

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

Re: new module mbscspn


From: Bruno Haible
Subject: Re: new module mbscspn
Date: Sun, 11 Feb 2007 23:35:43 +0100
User-agent: KMail/1.5.4

A small optimization was possible:

2007-02-11  Bruno Haible  <address@hidden>

        * lib/mbscspn.c (mbscspn): Remove unnecessary strlen call and
        unneeded cast.

--- lib/mbscspn.c       5 Feb 2007 02:52:43 -0000       1.1
+++ lib/mbscspn.c       11 Feb 2007 22:27:51 -0000
@@ -50,8 +50,8 @@
        {
          if (mb_len (mbui_cur (iter)) == 1)
            {
-             if (mbschr (accept, (unsigned char) * mbui_cur_ptr (iter)))
-               return mbui_cur_ptr (iter) - string;
+             if (mbschr (accept, * mbui_cur_ptr (iter)))
+               goto found;
            }
          else
            {
@@ -61,10 +61,11 @@
                   mbui_avail (aiter);
                   mbui_advance (aiter))
                if (mb_equal (mbui_cur (aiter), mbui_cur (iter)))
-                 return mbui_cur_ptr (iter) - string;
+                 goto found;
            }
        }
-      return strlen (string);
+     found:
+      return mbui_cur_ptr (iter) - string;
     }
   else
 #endif





reply via email to

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