aboutsummaryrefslogtreecommitdiff
path: root/src/hwcaps.c
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2021-06-30 09:51:26 +0000
committerGitHub <noreply@github.com>2021-06-30 11:51:26 +0200
commitb3ef4ef49d8ac3c37f5d60db5f37ee43f433aa2d (patch)
tree1060132b614fcf2b5710a306bff8706f9fdaabcf /src/hwcaps.c
parent001faefdc327e7013a581b99e3cdcbe0ba968277 (diff)
downloadcpu_features-b3ef4ef49d8ac3c37f5d60db5f37ee43f433aa2d.tar.gz
Avoid leaking internal headers for ppc (#164)
Diffstat (limited to 'src/hwcaps.c')
-rw-r--r--src/hwcaps.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/hwcaps.c b/src/hwcaps.c
index dd17e3b..605f892 100644
--- a/src/hwcaps.c
+++ b/src/hwcaps.c
@@ -35,7 +35,8 @@ bool CpuFeatures_IsHwCapsSet(const HardwareCapabilities hwcaps_mask,
#ifdef CPU_FEATURES_TEST
// In test mode, hwcaps_for_testing will define the following functions.
HardwareCapabilities CpuFeatures_GetHardwareCapabilities(void);
-PlatformType CpuFeatures_GetPlatformType(void);
+const char* CpuFeatures_GetPlatformPointer(void);
+const char* CpuFeatures_GetBasePlatformPointer(void);
#else
// Debug facilities
@@ -163,20 +164,12 @@ HardwareCapabilities CpuFeatures_GetHardwareCapabilities(void) {
return capabilities;
}
-PlatformType kEmptyPlatformType;
-
-PlatformType CpuFeatures_GetPlatformType(void) {
- PlatformType type = kEmptyPlatformType;
- char *platform = (char *)GetHardwareCapabilitiesFor(AT_PLATFORM);
- char *base_platform = (char *)GetHardwareCapabilitiesFor(AT_BASE_PLATFORM);
+const char *CpuFeatures_GetPlatformPointer(void) {
+ return (const char *)GetHardwareCapabilitiesFor(AT_PLATFORM);
+}
- if (platform != NULL)
- CpuFeatures_StringView_CopyString(str(platform), type.platform,
- sizeof(type.platform));
- if (base_platform != NULL)
- CpuFeatures_StringView_CopyString(str(base_platform), type.base_platform,
- sizeof(type.base_platform));
- return type;
+const char *CpuFeatures_GetBasePlatformPointer(void) {
+ return (const char *)GetHardwareCapabilitiesFor(AT_BASE_PLATFORM);
}
#endif // CPU_FEATURES_TEST