You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2005/12/23 23:45:39 UTC
svn commit: r358879 - /incubator/stdcxx/trunk/tests/algorithms/25.remove.cpp
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 <se...@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);