]> Savannah Git Hosting - gnulib.git/commitdiff
mbssep: Optimize.
authorBruno Haible <bruno@clisp.org>
Tue, 18 Jul 2023 11:33:08 +0000 (13:33 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 18 Jul 2023 11:33:08 +0000 (13:33 +0200)
* lib/mbssep.c: Include mbuiterf.h instead of mbuiter.h.
(mbssep): Use mbuif_* macros instead of mbui_* macros.
* modules/mbssep (Depends-on): Add mbuiterf. Remove mbuiter.

ChangeLog
lib/mbssep.c
modules/mbssep

index c0288b7ebcc27d7c5eb879b6b3a2938368c55a77..03a2465c0b2d9cbd64e304488dc6a16075289c24 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2023-07-18  Bruno Haible  <bruno@clisp.org>
 
+       mbssep: Optimize.
+       * lib/mbssep.c: Include mbuiterf.h instead of mbuiter.h.
+       (mbssep): Use mbuif_* macros instead of mbui_* macros.
+       * modules/mbssep (Depends-on): Add mbuiterf. Remove mbuiter.
+
        mbsrchr: Optimize.
        * lib/mbsrchr.c: Include mbuiterf.h instead of mbuiter.h.
        (mbsrchr): Use mbuif_* macros instead of mbui_* macros.
index 6158b55562e4dddf159dbf1e73290c5c2f008df1..31df5d1cef33035c03e6905e60c36d99190f9a31 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <stdlib.h>
 
-#include "mbuiter.h"
+#include "mbuiterf.h"
 
 char *
 mbssep (char **stringp, const char *delim)
@@ -47,14 +47,13 @@ mbssep (char **stringp, const char *delim)
         }
       else
         {
-          mbui_iterator_t iter;
-
-          mbui_init (iter, ptr);
-          if (!mbui_avail (iter))
+          mbuif_state_t state;
+          mbuif_init (state);
+          if (!mbuif_avail (state, ptr))
             abort ();
-          mbui_advance (iter);
+          mbchar_t cur = mbuif_next (state, ptr);
           *ptr = '\0';
-          *stringp = (char *) mbui_cur_ptr (iter);
+          *stringp = ptr + mb_len (cur);
           return start;
         }
     }
index a79538e21e06d1c22b6b4b7ef64097867111d290..6672d646419a17c26bbb528a0251942efc005065 100644 (file)
@@ -5,7 +5,7 @@ Files:
 lib/mbssep.c
 
 Depends-on:
-mbuiter
+mbuiterf
 string
 mbspbrk
 strsep