2023-07-18 Bruno Haible <bruno@clisp.org>
+ mbiterf: Fix compiler warnings.
+ * lib/mbiterf.h (mbiterf_next): Use C99 designated initializer syntax.
+ * tests/bench-mbiterf.c (do_test): Use a 'const char *' pointer.
+
trim: Optimize.
* lib/trim.c: Include mbiterf.h instead of mbiter.h.
(trim2): Use mbif_* macros instead of mbi_* macros.
their char code. For the few other ones, this is the case as well,
in all locale encodings that are in use. The 32-bit wide character
code is the same as well. */
- return (mbchar_t) { ptr: iter, bytes: 1, wc_valid: true, wc: *iter };
+ return (mbchar_t) { .ptr = iter, .bytes = 1, .wc_valid = true, .wc = *iter };
}
else
{
ps->in_shift = false;
#endif
mbszero (&ps->state);
- return (mbchar_t) { ptr: iter, bytes: 1, wc_valid: false };
+ return (mbchar_t) { .ptr = iter, .bytes = 1, .wc_valid = false };
}
else if (bytes == (size_t) -2)
{
#endif
/* Whether to reset ps->state or not is not important; the string end
is reached anyway. */
- return (mbchar_t) { ptr: iter, bytes: endptr - iter, wc_valid: false };
+ return (mbchar_t) { .ptr = iter, .bytes = endptr - iter, .wc_valid = false };
}
else
{
if (mbsinit (&ps->state))
ps->in_shift = false;
#endif
- return (mbchar_t) { ptr: iter, bytes: bytes, wc_valid: true, wc: wc };
+ return (mbchar_t) { .ptr = iter, .bytes = bytes, .wc_valid = true, .wc = wc };
}
}
}
unsigned long long sum = 0;
const char *text_end = text + text_len;
mbif_state_t state;
- char *iter;
+ const char *iter;
for (mbif_init (state), iter = text; mbif_avail (state, iter, text_end); )
{
mbchar_t cur = mbif_next (state, iter, text_end);