diff options
author | 2016-11-14 08:39:39 -0500 | |
---|---|---|
committer | 2016-11-14 14:07:54 +0000 | |
commit | bde64e438ae24f9f1c90fff5e1a12e71db5742de (patch) | |
tree | afd220ff026c71f389fef2a2428a6ea047049733 /include/core/SkTypes.h | |
parent | e7bd81d0a8e41432c9ad62e452742813b21e9923 (diff) |
Mark inline functions in SkTypes.h as static.
If these are not marked static (or SK_FORCE_INLINE) they become extremely dangerous to use from files built with different optimization flags than the baseline. The One Definition Rule becomes trivially easy to violate, and the linker can easily pick a CPU-specific version of the function.
TBR=reed@google.com
BUG=chromium:664864
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4752
Change-Id: If3044a32229db1a1e3a8b83aace6047d92b36d05
Reviewed-on: https://skia-review.googlesource.com/4752
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'include/core/SkTypes.h')
-rw-r--r-- | include/core/SkTypes.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 0a3e3ac487..2cc4b9c8a9 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -395,7 +395,7 @@ static inline constexpr int Sk32ToBool(uint32_t n) { /** Generic swap function. Classes with efficient swaps should specialize this function to take their fast path. This function is used by SkTSort. */ -template <typename T> inline void SkTSwap(T& a, T& b) { +template <typename T> static inline void SkTSwap(T& a, T& b) { T c(std::move(a)); a = std::move(b); b = std::move(c); @@ -409,7 +409,7 @@ static inline int32_t SkAbs32(int32_t value) { return value; } -template <typename T> inline T SkTAbs(T value) { +template <typename T> static inline T SkTAbs(T value) { if (value < 0) { value = -value; } |