• R/O
  • SSH
  • HTTPS

yash: Commit


Commit MetaInfo

Revision4171 (tree)
Time2021-09-01 00:08:12
Authormagicant

Log Message

Optimize field splitting code

Change Summary

Incremental Difference

--- yash/trunk/expand.c (revision 4170)
+++ yash/trunk/expand.c (revision 4171)
@@ -1,6 +1,6 @@
11 /* Yash: yet another shell */
22 /* expand.c: word expansion */
3-/* (C) 2007-2020 magicant */
3+/* (C) 2007-2021 magicant */
44
55 /* This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
@@ -1625,20 +1625,19 @@
16251625 continue;
16261626 }
16271627
1628- /* Now the current char is either null or a IFS non-whitespace. */
1628+ /* Now the current char is either null or an IFS non-whitespace. */
16291629
16301630 if (!afterfield)
16311631 add_empty_field(dest, &s[index]);
16321632
1633- /* skip (only one) IFS non-whitespace */
1634- if (is_ifs_char(s[index], cc[index], ifs)) {
1635- index++;
1636- afterfield = false;
1637- continue;
1638- }
1633+ if (s[index] == L'\0')
1634+ break;
16391635
1640- /* Now the current char is null. We're done. */
1641- break;
1636+ /* skip (only) one IFS non-whitespace */
1637+ assert(is_ifs_char(s[index], cc[index], ifs));
1638+ assert(!is_ifs_whitespace(s[index], cc[index], ifs));
1639+ index++;
1640+ afterfield = false;
16421641 }
16431642
16441643 /* remove the empty last field */
Show on old repository browser