Fix unused result errors in bionic.
This lets us use _FORTIFY_SOURCE=2 on the host. Change-Id: I69f5ff9834bfd595aae6584104bee10c4d8a5eeb
This commit is contained in:
parent
fe77d2d003
commit
c217373bd6
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdio_ext.h>
|
#include <stdio_ext.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <benchmark/Benchmark.h>
|
#include <benchmark/Benchmark.h>
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ static void FopenFgetsFclose(int iters, bool no_locking) {
|
|||||||
for (int i = 0; i < iters; ++i) {
|
for (int i = 0; i < iters; ++i) {
|
||||||
FILE* fp = fopen("/proc/version", "re");
|
FILE* fp = fopen("/proc/version", "re");
|
||||||
if (no_locking) __fsetlocking(fp, FSETLOCKING_BYCALLER);
|
if (no_locking) __fsetlocking(fp, FSETLOCKING_BYCALLER);
|
||||||
fgets(buf, sizeof(buf), fp);
|
if (fgets(buf, sizeof(buf), fp) == nullptr) abort();
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -21,7 +23,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "utils.h"
|
#include <base/stringprintf.h>
|
||||||
|
|
||||||
int Round(int n) {
|
int Round(int n) {
|
||||||
int base = 1;
|
int base = 1;
|
||||||
@ -72,10 +74,7 @@ std::string PrettyInt(long value, size_t base) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char* s = NULL;
|
return android::base::StringPrintf("%s%" PRId64 "%s",
|
||||||
asprintf(&s, "%s%" PRId64 "%s", (negative_number ? "-" : ""),
|
negative_number ? "-" : "",
|
||||||
count / kAmountPerUnit[i], kUnitStrings[i]);
|
count / kAmountPerUnit[i], kUnitStrings[i]);
|
||||||
std::string result(s);
|
|
||||||
free(s);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user