1
0
mirror of https://github.com/google/cpu_features.git synced 2025-07-01 05:11:15 +02:00

Explicitly namespace every extern identifier

This commit is contained in:
Arvid Gerstmann
2018-04-26 10:31:03 +02:00
parent 7eca4a7a39
commit a1ffdcbe70
12 changed files with 112 additions and 112 deletions

View File

@ -24,14 +24,14 @@
CPU_FEATURES_START_CPP_NAMESPACE
// Same as linux "open(filename, O_RDONLY)", retries automatically on EINTR.
int OpenFile(const char* filename);
int CpuFeatures_OpenFile(const char* filename);
// Same as linux "read(file_descriptor, buffer, buffer_size)", retries
// automatically on EINTR.
int ReadFile(int file_descriptor, void* buffer, size_t buffer_size);
int CpuFeatures_ReadFile(int file_descriptor, void* buffer, size_t buffer_size);
// Same as linux "close(file_descriptor)".
void CloseFile(int file_descriptor);
void CpuFeatures_CloseFile(int file_descriptor);
CPU_FEATURES_END_CPP_NAMESPACE

View File

@ -66,7 +66,7 @@ typedef struct {
uint32_t hwcaps2;
} HardwareCapabilities;
HardwareCapabilities GetHardwareCapabilities(void);
HardwareCapabilities CpuFeatures_GetHardwareCapabilities(void);
CPU_FEATURES_END_CPP_NAMESPACE

View File

@ -43,13 +43,13 @@ typedef struct {
// For every config, looks into flags_line for the presence of the
// corresponding proc_cpuinfo_flag, calls `set_bit` accordingly.
// Note: features is a pointer to the underlying Feature struct.
void SetFromFlags(const size_t configs_size, const CapabilityConfig* configs,
void CpuFeatures_SetFromFlags(const size_t configs_size, const CapabilityConfig* configs,
const StringView flags_line, void* const features);
// For every config, looks into hwcaps for the presence of the feature. Calls
// `set_bit` with true if the hardware capability is found.
// Note: features is a pointer to the underlying Feature struct.
void OverrideFromHwCaps(const size_t configs_size,
void CpuFeatures_OverrideFromHwCaps(const size_t configs_size,
const CapabilityConfig* configs,
const HardwareCapabilities hwcaps,
void* const features);

View File

@ -46,54 +46,54 @@ static inline StringView view(const char* str, const size_t size) {
static inline StringView str(const char* str) { return view(str, strlen(str)); }
// Returns the index of the first occurrence of c in view or -1 if not found.
int IndexOfChar(const StringView view, char c);
int CpuFeatures_StringView_IndexOfChar(const StringView view, char c);
// Returns the index of the first occurrence of sub_view in view or -1 if not
// found.
int IndexOf(const StringView view, const StringView sub_view);
int CpuFeatures_StringView_IndexOf(const StringView view, const StringView sub_view);
// Returns whether a is equal to b (same content).
bool IsEquals(const StringView a, const StringView b);
bool CpuFeatures_StringView_IsEquals(const StringView a, const StringView b);
// Returns whether a starts with b.
bool StartsWith(const StringView a, const StringView b);
bool CpuFeatures_StringView_StartsWith(const StringView a, const StringView b);
// Removes count characters from the beginning of view or kEmptyStringView if
// count if greater than view.size.
StringView PopFront(const StringView view, size_t count);
StringView CpuFeatures_StringView_PopFront(const StringView view, size_t count);
// Removes count characters from the end of view or kEmptyStringView if count if
// greater than view.size.
StringView PopBack(const StringView str_view, size_t count);
StringView CpuFeatures_StringView_PopBack(const StringView str_view, size_t count);
// Keeps the count first characters of view or view if count if greater than
// view.size.
StringView KeepFront(const StringView view, size_t count);
StringView CpuFeatures_StringView_KeepFront(const StringView view, size_t count);
// Retrieves the first character of view. If view is empty the behavior is
// undefined.
char Front(const StringView view);
char CpuFeatures_StringView_Front(const StringView view);
// Retrieves the last character of view. If view is empty the behavior is
// undefined.
char Back(const StringView view);
char CpuFeatures_StringView_Back(const StringView view);
// Removes leading and tailing space characters.
StringView TrimWhitespace(StringView view);
StringView CpuFeatures_StringView_TrimWhitespace(StringView view);
// Convert StringView to positive integer. e.g. "42", "0x2a".
// Returns -1 on error.
int ParsePositiveNumber(const StringView view);
int CpuFeatures_StringView_ParsePositiveNumber(const StringView view);
// Copies src StringView to dst buffer.
void CopyString(const StringView src, char* dst, size_t dst_size);
void CpuFeatures_StringView_CopyString(const StringView src, char* dst, size_t dst_size);
// Checks if line contains the specified whitespace separated word.
bool HasWord(const StringView line, const char* const word);
bool CpuFeatures_StringView_HasWord(const StringView line, const char* const word);
// Get key/value from line. key and value are separated by ": ".
// key and value are cleaned up from leading and trailing whitespaces.
bool GetAttributeKeyValue(const StringView line, StringView* key,
bool CpuFeatures_StringView_GetAttributeKeyValue(const StringView line, StringView* key,
StringView* value);
CPU_FEATURES_END_CPP_NAMESPACE