stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r358879 - /incubator/stdcxx/trunk/tests/algorithms/25.remove.cpp
Date Fri, 23 Dec 2005 22:45:39 GMT
Author: sebor
Date: Fri Dec 23 14:45:35 2005
New Revision: 358879

URL: http://svn.apache.org/viewcvs?rev=358879&view=rev
Log:
2005-12-23  Martin Sebor  <sebor@roguewave.com>

	* 25.remove.cpp (ToString): Simplified the invocation of rw_asnprintf().

Modified:
    incubator/stdcxx/trunk/tests/algorithms/25.remove.cpp

Modified: incubator/stdcxx/trunk/tests/algorithms/25.remove.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/algorithms/25.remove.cpp?rev=358879&r1=358878&r2=358879&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/algorithms/25.remove.cpp (original)
+++ incubator/stdcxx/trunk/tests/algorithms/25.remove.cpp Fri Dec 23 14:45:35 2005
@@ -25,8 +25,8 @@
 #include <cstring>      // for strlen()
 
 #include <alg_test.h>
-#include <driver.h>      // for rw_test()
-#include <printf.h>      // for rw_asnprintf()
+#include <driver.h>     // for rw_test()
+#include <printf.h>     // for rw_asnprintf()
 
 /**************************************************************************/
 
@@ -89,23 +89,13 @@
         char* tmp = 0;
 
         for (const T *cur = first; cur != last; ++cur) {
-            if (use_id) {
-               rw_asnprintf (&tmp, &buf_sz, 
-                             "%s%s%d:%{lc}%s",
-                             res,
-                             cur - first == pos ? ">" : "",
-                             cur->id_,
-                             cur->val_,
-                             cur - first == pos ? "<" : "");
-            }
-            else {
-                rw_asnprintf (&tmp, &buf_sz, 
-                              "%s%s%{lc}%s",
-                              res,
-                              cur - first == pos ? ">" : "",
-                              cur->val_,
-                              cur - first == pos ? "<" : "");
-            }
+            rw_asnprintf (&tmp, &buf_sz, 
+                          "%s%{?}>%{;}%{?}%d:%{;}%{lc}%{?}<%{;}",
+                          res,
+                          cur - first == pos,    // '>'
+                          use_id, cur->id_,      // "<id>:"
+                          cur->val_,             // <val>
+                          cur - first == pos);   // '<'
 
             if (res != &nul_char)
                 std::free (res);



Mime
View raw message