mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
[string] Allow length to handle NULs
printf 'a\0b' | string length used to print "1". Now it prints "3". Note that this switches to using C++'s std::string::length, which might give differing results.
This commit is contained in:
parent
bcd23ff971
commit
485fdbde41
1 changed files with 2 additions and 2 deletions
|
@ -681,8 +681,8 @@ static int string_length(parser_t &parser, io_streams_t &streams, int argc, wcha
|
|||
|
||||
int nnonempty = 0;
|
||||
arg_iterator_t aiter(argv, optind, streams);
|
||||
while (const wchar_t *arg = aiter.next()) {
|
||||
size_t n = wcslen(arg);
|
||||
while (auto arg = aiter.nextstr()) {
|
||||
size_t n = arg->length();
|
||||
if (n > 0) {
|
||||
nnonempty++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue