Fix unused result errors in bionic.
This lets us use _FORTIFY_SOURCE=2 on the host.
Change-Id: I69f5ff9834bfd595aae6584104bee10c4d8a5eeb
diff --git a/benchmarks/utils.cpp b/benchmarks/utils.cpp
index 863b9db..cf17edb 100644
--- a/benchmarks/utils.cpp
+++ b/benchmarks/utils.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include "utils.h"
+
#include <inttypes.h>
#include <stdio.h>
#include <stdint.h>
@@ -21,7 +23,7 @@
#include <string>
-#include "utils.h"
+#include <base/stringprintf.h>
int Round(int n) {
int base = 1;
@@ -72,10 +74,7 @@
break;
}
}
- char* s = NULL;
- asprintf(&s, "%s%" PRId64 "%s", (negative_number ? "-" : ""),
- count / kAmountPerUnit[i], kUnitStrings[i]);
- std::string result(s);
- free(s);
- return result;
+ return android::base::StringPrintf("%s%" PRId64 "%s",
+ negative_number ? "-" : "",
+ count / kAmountPerUnit[i], kUnitStrings[i]);
}