[latex3-commits] [git/LaTeX3-latex3-latex3] master: Reduce repetition in code (3285f6a)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Jul 26 18:59:18 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/3285f6a8a407c6d362155a8dbc047bc80066632a

>---------------------------------------------------------------

commit 3285f6a8a407c6d362155a8dbc047bc80066632a
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Thu Jul 26 17:59:18 2018 +0100

    Reduce repetition in code
    
    Thanks to BLF for the suggestion.


>---------------------------------------------------------------

3285f6a8a407c6d362155a8dbc047bc80066632a
 l3kernel/l3candidates.dtx |   27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index fb352cb..7bdd10f 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -2928,29 +2928,10 @@
 % \begin{macro}[pTF]{\sys_if_platform_windows:}
 %   We can now set up the tests.
 %    \begin{macrocode}
-\cs_new_eq:NN \sys_if_platform_unix:T \use_none:n
-\cs_new_eq:NN \sys_if_platform_unix:F \use:n
-\cs_new_eq:NN \sys_if_platform_unix:TF \use_ii:nn
-\cs_new_eq:NN \sys_if_platform_unix_p: \c_false_bool
-\cs_new_eq:NN \sys_if_platform_windows:T \use_none:n
-\cs_new_eq:NN \sys_if_platform_windows:F \use:n
-\cs_new_eq:NN \sys_if_platform_windows:TF \use_ii:nn
-\cs_new_eq:NN \sys_if_platform_windows_p: \c_false_bool
-\str_if_eq:VnTF \c_sys_platform_str { unix }
-  {
-    \cs_set_eq:NN \sys_if_platform_unix:T \use:n
-    \cs_set_eq:NN \sys_if_platform_unix:F \use_none:n
-    \cs_set_eq:NN \sys_if_platform_unix:TF \use_i:nn
-    \cs_set_eq:NN \sys_if_platform_unix_p: \c_true_bool
-  }
-  {
-    \str_if_eq:VnT \c_sys_platform_str { windows }
-      {
-        \cs_set_eq:NN \sys_if_platform_windows:T \use:n
-        \cs_set_eq:NN \sys_if_platform_windows:F \use_none:n
-        \cs_set_eq:NN \sys_if_platform_windows:TF \use_i:nn
-        \cs_set_eq:NN \sys_if_platform_windows_p: \c_true_bool
-      }
+\clist_map_inline:nn { unix , windows }
+  {
+    \@@_const:nn { sys_if_platform_ #1 }
+      { \str_if_eq_p:Vn \c_sys_platform_str { #1 } }
   }
 %    \end{macrocode}
 % \end{macro}





More information about the latex3-commits mailing list