mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Fix the compilation under gcc 4.9.0.
gcc interpretes C99's compound literals more strictly by invalid the compound literal on implicit to pointer cast (because of automatic storage duration, 6.5.2.5.6 in C99 standard draft). This fixes the issue by not using compound literals at all.
This commit is contained in:
parent
f9f773cc28
commit
1f3a93a3af
1 changed files with 7 additions and 1 deletions
|
@ -2636,7 +2636,13 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
for (; i+1 < argc; ++i)
|
for (; i+1 < argc; ++i)
|
||||||
{
|
{
|
||||||
env_set(argv[i], j < bufflen ? (wchar_t[2]){buff[j], 0} : L"", place);
|
if (j < bufflen) {
|
||||||
|
wchar_t buffer[2] = {buff[j], 0};
|
||||||
|
env_set(argv[i], buffer, place);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
env_set(argv[i], L"", place);
|
||||||
|
}
|
||||||
if (j < bufflen) ++j;
|
if (j < bufflen) ++j;
|
||||||
}
|
}
|
||||||
if (i < argc) env_set(argv[i], &buff[j], place);
|
if (i < argc) env_set(argv[i], &buff[j], place);
|
||||||
|
|
Loading…
Reference in a new issue