[latex3-commits] [git/LaTeX3-latex3-latex3] filename-sanitize: Faster strip quotes and trim spaces (120ef95cd)
PhelypeOleinik
phelype.oleinik at latex-project.org
Sat Apr 17 23:23:20 CEST 2021
Repository : https://github.com/latex3/latex3
On branch : filename-sanitize
Link : https://github.com/latex3/latex3/commit/120ef95cd113dbd277eb6239bdc342f9b0f51d12
>---------------------------------------------------------------
commit 120ef95cd113dbd277eb6239bdc342f9b0f51d12
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Sat Apr 17 18:23:20 2021 -0300
Faster strip quotes and trim spaces
>---------------------------------------------------------------
120ef95cd113dbd277eb6239bdc342f9b0f51d12
l3kernel/l3file.dtx | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/l3kernel/l3file.dtx b/l3kernel/l3file.dtx
index 92ed0715e..bc41896c0 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.