Remove include of stdlib.h from SkTypes.h.
Unfortunately, immintrin.h (which is also included by SkTypes)
includes xmmintrin.h which includes mm_malloc.h which includes
stdlib.h for malloc even though, from the implementation, it is
difficult to see why.
Fortunately, arm_neon.h does not seem to be involved in such
shenanigans, so building for Android will keep things sane.
TBR=reed@google.com
Doesn't change Skia API, just moves an include.
Review URL: https://codereview.chromium.org/1313203003
diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp
index 9f9c321..cec8dde 100644
--- a/tests/PathOpsAngleTest.cpp
+++ b/tests/PathOpsAngleTest.cpp
@@ -51,7 +51,7 @@
float p2 = SkDoubleToScalar(line[1].fY * test.fX);
int p1Bits = SkFloatAs2sCompliment(p1);
int p2Bits = SkFloatAs2sCompliment(p2);
- int epsilon = abs(p1Bits - p2Bits);
+ int epsilon = SkTAbs(p1Bits - p2Bits);
if (maxEpsilon < epsilon) {
SkDebugf("line={{0, 0}, {%1.7g, %1.7g}} t=%1.7g pt={%1.7g, %1.7g}"
" epsilon=%d\n",
@@ -104,7 +104,7 @@
float p2 = SkDoubleToScalar(line[1].fY * last.fX);
int p1Bits = SkFloatAs2sCompliment(p1);
int p2Bits = SkFloatAs2sCompliment(p2);
- int epsilon = abs(p1Bits - p2Bits);
+ int epsilon = SkTAbs(p1Bits - p2Bits);
if (maxEpsilon < epsilon) {
SkDebugf("line={{0, 0}, {%1.7g, %1.7g}} t=%1.7g/%1.7g/%1.7g moveT=%1.7g"
" pt={%1.7g, %1.7g} epsilon=%d\n",
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index 75a5cc3..d45ec06 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -12,6 +12,8 @@
#include "SkReduceOrder.h"
#include "Test.h"
+#include <stdlib.h>
+
const int firstCubicIntersectionTest = 9;
static void standardTestCases(skiatest::Reporter* reporter) {
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index d458c41..1401290 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -16,6 +16,8 @@
#include "SkRTConf.h"
#include "SkStream.h"
+#include <stdlib.h>
+
#ifdef SK_BUILD_FOR_MAC
#include <sys/sysctl.h>
#endif
diff --git a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
index 7e33b7b..a4f87df 100644
--- a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
@@ -91,7 +91,7 @@
SkDPoint xy = quad.ptAtT(tIndex / 4.0);
for (int h = -2; h <= 2; ++h) {
for (int v = -2; v <= 2; ++v) {
- if (h == v && abs(h) != 1) {
+ if (h == v && SkTAbs(h) != 1) {
continue;
}
double x = xy.fX;
diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp
index 6f3d014..95421fc 100755
--- a/tests/PathOpsSkpClipTest.cpp
+++ b/tests/PathOpsSkpClipTest.cpp
@@ -32,6 +32,8 @@
#include "SkTemplates.h"
#include "SkTime.h"
+#include <stdlib.h>
+
__SK_FORCE_IMAGE_DECODER_LINKING;
/* add local exceptions here */
diff --git a/tests/RTConfRegistryTest.cpp b/tests/RTConfRegistryTest.cpp
index 59fb3e9..84ce942 100644
--- a/tests/RTConfRegistryTest.cpp
+++ b/tests/RTConfRegistryTest.cpp
@@ -8,6 +8,8 @@
#include "SkRTConf.h"
#include "Test.h"
+#include <stdlib.h>
+
// Friended proxy for SkRTConfRegistry::parse()
template <typename T>
bool test_rt_conf_parse(SkRTConfRegistry* reg, const char* key, T* value) {
diff --git a/tests/SortTest.cpp b/tests/SortTest.cpp
index e8713dd..d544ebd 100644
--- a/tests/SortTest.cpp
+++ b/tests/SortTest.cpp
@@ -9,6 +9,8 @@
#include "SkTSort.h"
#include "Test.h"
+#include <stdlib.h>
+
extern "C" {
static int compare_int(const void* a, const void* b) {
return *(const int*)a - *(const int*)b;
diff --git a/tests/Time.cpp b/tests/Time.cpp
index 60dcd55..cf4f80f 100644
--- a/tests/Time.cpp
+++ b/tests/Time.cpp
@@ -44,7 +44,7 @@
// The westernmost timezone is -12:00.
// The easternmost timezone is +14:00.
- REPORTER_ASSERT(r, abs(SkToInt(dateTime.fTimeZoneMinutes)) <= 14 * 60);
+ REPORTER_ASSERT(r, SkTAbs(SkToInt(dateTime.fTimeZoneMinutes)) <= 14 * 60);
SkString timeStamp;
dateTime.toISO8601(&timeStamp);