[latex3-commits] [l3svn] r6700 - Tweak a conditional to avoid using \c_minus_one

noreply at latex-project.org noreply at latex-project.org
Thu Sep 8 00:16:49 CEST 2016


Author: bruno
Date: 2016-09-08 00:16:49 +0200 (Thu, 08 Sep 2016)
New Revision: 6700

Modified:
   trunk/l3kernel/l3int.dtx
Log:
Tweak a conditional to avoid using \c_minus_one

Previously, \int_const:Nn \c_foo_int { error } ended up
(after some errors) setting \c_minus_one=0 (because this
constant is unavoidably a counter).  This can lead to
infinite loops and other crazyness.


Modified: trunk/l3kernel/l3int.dtx
===================================================================
--- trunk/l3kernel/l3int.dtx	2016-09-07 16:03:15 UTC (rev 6699)
+++ trunk/l3kernel/l3int.dtx	2016-09-07 22:16:49 UTC (rev 6700)
@@ -1177,8 +1177,12 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \int_const:Nn #1#2
   {
-    \int_compare:nNnTF {#2} > \c_minus_one
+    \int_compare:nNnTF {#2} < \c_zero
       {
+        \int_new:N #1
+        \int_gset:Nn #1 {#2}
+      }
+      {
         \int_compare:nNnTF {#2} > \c__max_constdef_int
           {
             \int_new:N #1
@@ -1190,10 +1194,6 @@
               \@@_eval:w #2 \@@_eval_end:
           }
       }
-      {
-        \int_new:N #1
-        \int_gset:Nn #1 {#2}
-      }
   }
 \cs_generate_variant:Nn \int_const:Nn { c }
 \if_int_odd:w 0



More information about the latex3-commits mailing list