mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Eliminate usage of __mb_cur_max, try to fix Linux build
This commit is contained in:
parent
c5031c2b39
commit
87baa4d3d2
1 changed files with 2 additions and 4 deletions
|
@ -302,8 +302,7 @@ std::string wcs2string(const wcstring &input)
|
||||||
mbstate_t state;
|
mbstate_t state;
|
||||||
memset(&state, 0, sizeof(state));
|
memset(&state, 0, sizeof(state));
|
||||||
|
|
||||||
size_t converted_max_len = (size_t)(1 + __mb_cur_max);
|
char converted[MB_LEN_MAX + 1];
|
||||||
char *converted = new char[converted_max_len];
|
|
||||||
|
|
||||||
for (size_t i=0; i < input.size(); i++)
|
for (size_t i=0; i < input.size(); i++)
|
||||||
{
|
{
|
||||||
|
@ -318,7 +317,7 @@ std::string wcs2string(const wcstring &input)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bzero(converted, converted_max_len);
|
bzero(converted, sizeof converted);
|
||||||
size_t len = wcrtomb(converted, wc, &state);
|
size_t len = wcrtomb(converted, wc, &state);
|
||||||
if (len == (size_t)(-1))
|
if (len == (size_t)(-1))
|
||||||
{
|
{
|
||||||
|
@ -332,7 +331,6 @@ std::string wcs2string(const wcstring &input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] converted;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue