+#include <_simple.h>
+
+/*
+ * __wcs_end_offset calculates the offset to the end within the wide character
+ * string, assuming numbers and letters are single bytes in multibyte
+ * representation, get the actual decimal string for localeconv_l. If the
+ * decimal point was within the string, compensate for the fact that the
+ * (possible more than one byte) decimal point one takes one wide character.
+ */
+__private_extern__ size_t
+__wcs_end_offset(const char * __restrict buf, const char * __restrict end, locale_t loc)
+{
+ const char *decimalpoint = localeconv_l(loc)->decimal_point;
+ size_t n = end - buf;
+ char *p;
+
+ if ((p = strnstr(buf, decimalpoint, n)) != NULL)
+ n -= strlen(decimalpoint) - 1;
+ return n;
+}