mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-04-30 19:09:18 +08:00
Replace strtok_r with strchr in RISC-V CPU capability detection
This fixes a build failure on bare-metal toolchains like riscv64-unknown-elf-clang++ where strtok_r may be undeclared. Bug: 477295731 Change-Id: If4edd6c6d2e975ae34278f479700ef9b996c0a3e Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/7744872 Reviewed-by: James Zern <jzern@google.com>
This commit is contained in:
parent
5b5a2f6b92
commit
5cfaa44d71
@ -53,11 +53,6 @@ extern "C" {
|
||||
#define SAFEBUFFERS
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// MSVC provides strtok_s which is functionally equivalent to strtok_r.
|
||||
#define strtok_r strtok_s
|
||||
#endif
|
||||
|
||||
// cpu_info_ variable for SIMD instruction sets detected.
|
||||
LIBYUV_API int cpu_info_ = 0;
|
||||
|
||||
@ -338,14 +333,18 @@ LIBYUV_API SAFEBUFFERS int RiscvCpuCaps(const char* cpuinfo_name) {
|
||||
extensions_len = strlen(extensions);
|
||||
// Multi-letter extensions are seperated by a single underscore
|
||||
// as described in RISC-V User-Level ISA V2.2.
|
||||
char* saveptr = NULL;
|
||||
char* ext = strtok_r(extensions, "_", &saveptr);
|
||||
char* ext = extensions;
|
||||
while (ext) {
|
||||
char* next = strchr(ext, '_');
|
||||
if (next) {
|
||||
*next = '\0';
|
||||
next++;
|
||||
}
|
||||
// Search for the ZVFH (Vector FP16) extension.
|
||||
if (!strcmp(ext, "zvfh")) {
|
||||
flag |= kCpuHasRVVZVFH;
|
||||
}
|
||||
ext = strtok_r(NULL, "_", &saveptr);
|
||||
ext = next;
|
||||
}
|
||||
}
|
||||
std_isa_len = isa_len - extensions_len - 5;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user