Mercurial > vim
diff src/xxd/xxd.c @ 25980:0ff315dd0c48 v8.2.3523
patch 8.2.3523: duplicated code in xxd
Commit: https://github.com/vim/vim/commit/c89c91cafd91fbf17f431d800bbf4cafcffffe7a
Author: DungSaga <dungsaga@users.noreply.github.com>
Date: Sat Oct 16 19:07:46 2021 +0100
patch 8.2.3523: duplicated code in xxd
Problem: Duplicated code in xxd.
Solution: Remove duplicated lines. (closes https://github.com/vim/vim/issues/8972)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 16 Oct 2021 20:15:03 +0200 |
parents | 5690cf66ee07 |
children | 2294ed638906 |
line wrap: on
line diff
--- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -346,16 +346,12 @@ huntype( n1 = -1; if ((++p >= cols) && !hextype) { - /* skip rest of line as garbage */ - want_off = 0; - while ((c = getc(fpi)) != '\n' && c != EOF) - ; - if (c == EOF && ferror(fpi)) - die(2); - ign_garb = 1; + /* skip the rest of the line as garbage */ + n2 = -1; + n3 = -1; } } - else if (n1 < 0 && n2 < 0 && n3 < 0) + if (n1 < 0 && n2 < 0 && n3 < 0) { /* already stumbled into garbage, skip line, wait and see */ if (!hextype)