diff --git a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp @@ -259,17 +259,24 @@ #if !SCUDO_FUCHSIA TEST(ScudoWrappersCTest, MallInfo) { const size_t BypassQuarantineSize = 1024U; + auto MallInfo = []() { +#ifdef mallinfo2 + return mallinfo2(); +#else + return mallinfo(); +#endif + }; - struct mallinfo MI = mallinfo(); + auto MI = MallInfo(); size_t Allocated = MI.uordblks; void *P = malloc(BypassQuarantineSize); EXPECT_NE(P, nullptr); - MI = mallinfo(); + MI = MallInfo(); EXPECT_GE(static_cast(MI.uordblks), Allocated + BypassQuarantineSize); EXPECT_GT(static_cast(MI.hblkhd), 0U); size_t Free = MI.fordblks; free(P); - MI = mallinfo(); + MI = MallInfo(); EXPECT_GE(static_cast(MI.fordblks), Free + BypassQuarantineSize); } #endif