autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/5] m4sh: reduce size of AS_VAR_TEST_SET


From: Eric Blake
Subject: [PATCH 4/5] m4sh: reduce size of AS_VAR_TEST_SET
Date: Wed, 25 Aug 2010 17:18:20 -0600

* lib/m4sugar/m4sh.m4 (AS_VAR_TEST_SET): Make more compact.

Signed-off-by: Eric Blake <address@hidden>
---

I noticed this one while spotting a similar size reduction by
using :+ in patch 5/5.  But this one doesn't use :, so it
deserves to go in by itself.  It shaves 5k off coreutils' configure!
I'm quite impressed with how slick this trick is.

 ChangeLog           |    5 +++++
 lib/m4sugar/m4sh.m4 |    8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0cefc7c..f7a06a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-08-25  Eric Blake  <address@hidden>

+       m4sh: reduce size of AS_VAR_TEST_SET
+       * lib/m4sugar/m4sh.m4 (AS_VAR_TEST_SET): Make more compact.
+
+2010-08-25  Eric Blake  <address@hidden>
+
        tests: improve some shell assumption testing
        * tests/m4sh.at (Functions Support, Functions and return Support)
        (Negated classes in globbing): Update comments.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 6b1c1ea..facd70d 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -2063,13 +2063,13 @@ m4_define([AS_VAR_SET_IF],

 # AS_VAR_TEST_SET(VARIABLE)
 # -------------------------
-# Expands into the `test' expression which is true if VARIABLE
+# Expands into an expression which is true if VARIABLE
 # is set.  Polymorphic.
 m4_define([AS_VAR_TEST_SET],
 [AS_LITERAL_WORD_IF([$1],
-              [test "${$1+set}" = set],
-              [{ as_var=$1; eval "test \"\${$as_var+set}\" = set"; }],
-              [eval "test \"\${$1+set}\"" = set])])
+  [${$1+:} false],
+  [{ as_var=$1; eval \${$as_var+:} false; }],
+  [eval \${$1+:} false])])


 ## -------------------- ##
-- 
1.7.2.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]