Index: src/core/SkUtils.cpp |
diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp |
index 591a198c6510a52603b62546b10d977430afd5a4..eff718b20fbfce51f2c6c4a5416eee273dd5878a 100644 |
--- a/src/core/SkUtils.cpp |
+++ b/src/core/SkUtils.cpp |
@@ -113,34 +113,40 @@ static void sk_memcpy32_portable(uint32_t dst[], const uint32_t src[], int count |
memcpy(dst, src, count * sizeof(uint32_t)); |
} |
-static SkMemset16Proc choose_memset16() { |
+namespace { |
+// These three methods technically need external linkage to be passed as template parameters. |
+// Since they can't be static, we hide them in an anonymous namespace instead. |
+ |
+SkMemset16Proc choose_memset16() { |
SkMemset16Proc proc = SkMemset16GetPlatformProc(); |
return proc ? proc : sk_memset16_portable; |
} |
-void sk_memset16(uint16_t dst[], uint16_t value, int count) { |
- SK_DECLARE_STATIC_LAZY_FN_PTR(SkMemset16Proc, choice); |
- return choice.get(choose_memset16)(dst, value, count); |
-} |
- |
-static SkMemset32Proc choose_memset32() { |
+SkMemset32Proc choose_memset32() { |
SkMemset32Proc proc = SkMemset32GetPlatformProc(); |
return proc ? proc : sk_memset32_portable; |
} |
-void sk_memset32(uint32_t dst[], uint32_t value, int count) { |
- SK_DECLARE_STATIC_LAZY_FN_PTR(SkMemset32Proc, choice); |
- return choice.get(choose_memset32)(dst, value, count); |
-} |
- |
-static SkMemcpy32Proc choose_memcpy32() { |
+SkMemcpy32Proc choose_memcpy32() { |
SkMemcpy32Proc proc = SkMemcpy32GetPlatformProc(); |
return proc ? proc : sk_memcpy32_portable; |
} |
+} // namespace |
+ |
+void sk_memset16(uint16_t dst[], uint16_t value, int count) { |
+ SK_DECLARE_STATIC_LAZY_FN_PTR(SkMemset16Proc, proc, choose_memset16); |
+ proc.get()(dst, value, count); |
+} |
+ |
+void sk_memset32(uint32_t dst[], uint32_t value, int count) { |
+ SK_DECLARE_STATIC_LAZY_FN_PTR(SkMemset32Proc, proc, choose_memset32); |
+ proc.get()(dst, value, count); |
+} |
+ |
void sk_memcpy32(uint32_t dst[], const uint32_t src[], int count) { |
- SK_DECLARE_STATIC_LAZY_FN_PTR(SkMemcpy32Proc, choice); |
- return choice.get(choose_memcpy32)(dst, src, count); |
+ SK_DECLARE_STATIC_LAZY_FN_PTR(SkMemcpy32Proc, proc, choose_memcpy32); |
+ proc.get()(dst, src, count); |
} |
/////////////////////////////////////////////////////////////////////////////// |