[latex3-commits] [git/LaTeX3-latex3-latex3] filename-sanitize: Faster strip quotes and trim spaces (566682692)
PhelypeOleinik
phelype.oleinik at latex-project.org
Sat Apr 17 22:28:31 CEST 2021
Repository : https://github.com/latex3/latex3
On branch : filename-sanitize
Link : https://github.com/latex3/latex3/commit/566682692e9187471a92172754df93e2cab17c66
>---------------------------------------------------------------
commit 566682692e9187471a92172754df93e2cab17c66
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Sat Apr 17 17:28:31 2021 -0300
Faster strip quotes and trim spaces
>---------------------------------------------------------------
566682692e9187471a92172754df93e2cab17c66
l3kernel/l3file.dtx | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/l3kernel/l3file.dtx b/l3kernel/l3file.dtx
index 81dcff365..43934babd 100644
--- a/l3kernel/l3file.dtx
+++ b/l3kernel/l3file.dtx
@@ -2526,23 +2526,26 @@
% \begin{macrocode}
\cs_new:Npn \@@_name_strip_quotes:n #1
{
- \@@_name_strip_quotes:nnnw {#1} { 0 } { }
- #1 " \q_@@_recursion_tail " \q_@@_recursion_stop
+ \@@_name_strip_quotes:nw { 0 }
+ #1 " \q_@@_recursion_tail " \q_@@_recursion_stop {#1}
}
-\cs_new:Npn \@@_name_strip_quotes:nnnw #1#2#3#4 "
+\cs_new:Npn \@@_name_strip_quotes:nw #1#2 "
{
- \@@_if_recursion_tail_stop_do:nn {#4}
- { \@@_name_strip_quotes:nnn {#1} {#2} {#3} }
- \@@_name_strip_quotes:nnnw {#1} { #2 + 1 } { #3#4 }
+ \if_meaning:w \q_@@_recursion_tail #2
+ \@@_name_strip_quotes_end:wnwn
+ \fi:
+ #2
+ \@@_name_strip_quotes:nw { #1 + 1 }
}
-\cs_new:Npn \@@_name_strip_quotes:nnn #1#2#3
+\cs_new:Npn \@@_name_strip_quotes_end:wnwn \fi: #1
+ \@@_name_strip_quotes:nw #2 \q_@@_recursion_stop #3
{
- \int_if_even:nT {#2}
+ \fi:
+ \int_if_odd:nT {#2}
{
\__kernel_msg_expandable_error:nnn
- { kernel } { unbalanced-quote-in-filename } {#1}
+ { kernel } { unbalanced-quote-in-filename } {#3}
}
- #3
}
% \end{macrocode}
% Spaces need to be trimmed from the start of the name and from the end of
@@ -2557,8 +2560,8 @@
{
\@@_quark_if_nil:nTF {#3}
{
- \exp_args:Ne \@@_name_trim_spaces_aux:n
- { \tl_trim_spaces:n { #1 \s_@@_stop } }
+ \tl_trim_spaces_apply:nN { #1 \s_@@_stop }
+ \@@_name_trim_spaces_aux:n
}
{ \tl_trim_spaces:n {#1} }
}
More information about the latex3-commits
mailing list.