Support mcel API for apps that prefer it.
The following changes are in effect only if GNULIB_MCEL_PREFER.
* lib/mbslen.c: Include mcel.h instead of mbuiterf.h.
(mbslen): Use mcel API.
2023-09-09 Paul Eggert <eggert@cs.ucla.edu>
+ mbslen: support GNULIB_MCEL_PREFER
+ Support mcel API for apps that prefer it.
+ The following changes are in effect only if GNULIB_MCEL_PREFER.
+ * lib/mbslen.c: Include mcel.h instead of mbuiterf.h.
+ (mbslen): Use mcel API.
+
chown: work around symlink issues on odd platforms
Problem reported by Jordi Sanfeliu in:
https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00116.html
#include <stdlib.h>
-#include "mbuiterf.h"
+#if GNULIB_MCEL_PREFER
+# include "mcel.h"
+#else
+# include "mbuiterf.h"
+#endif
/* Return the number of multibyte characters in the character string STRING. */
size_t
{
size_t count = 0;
+#if GNULIB_MCEL_PREFER
+ for (; *string; string += mcel_scanz (string).len)
+ count++;
+#else
mbuif_state_t state;
const char *iter;
for (mbuif_init (state), iter = string; mbuif_avail (state, iter); )
count++;
iter += mb_len (cur);
}
+#endif
return count;
}