sed: revert "deal with musl-like mbrtoc32 ..."
* sed/sed.h (c32rtomb1): Revert recent change, as recent Gnulib changes should make it unnecessary.
This commit is contained in:
1 parent
64d80e20f3
commit
a179e7a8ad
1 file changed
+2
-11
@@ -291,22 +291,13 @@ extern bool sandbox;
|
||||
/* If set, print debugging information. */
|
||||
extern bool debug;
|
||||
|
||||
/* Convert to S the character CH. S must point to at least MB_LEN_MAX bytes.
|
||||
/* Convert to S the character CH.
|
||||
Return the number of bytes in S's representation. */
|
||||
SED_INLINE idx_t
|
||||
c32rtomb1 (char *s, char32_t ch)
|
||||
{
|
||||
mbstate_t mbs; mbszero (&mbs);
|
||||
size_t nbytes = c32rtomb (s, ch, &mbs);
|
||||
if (nbytes == (size_t) {-1})
|
||||
{
|
||||
/* This can happen if the Gnulib mbrtoc32 is in use in the C locale,
|
||||
and has converted (e.g.) '\xE8' to 0xDFE8. Translate it back
|
||||
by assigning, which keeps only the low 8 bits. */
|
||||
*s = ch;
|
||||
nbytes = 1;
|
||||
}
|
||||
return nbytes;
|
||||
return c32rtomb (s, ch, &mbs);
|
||||
}
|
||||
|
||||
/* Use this to suppress gcc's '...may be used before initialized' warnings. */
|
||||
|
||||
Reference in new issue
Block a user