Skip to content

Using optimized funcs std::find, strchr with char param, constexpr calc len out-of-loop#791

Closed
GermanAizek wants to merge 2 commits into
intel:masterfrom
GermanAizek:fixes
Closed

Using optimized funcs std::find, strchr with char param, constexpr calc len out-of-loop#791
GermanAizek wants to merge 2 commits into
intel:masterfrom
GermanAizek:fixes

Conversation

@GermanAizek
Copy link
Copy Markdown
Contributor

No description provided.

@JablonskiMateusz
Copy link
Copy Markdown
Contributor

please update year in copyright header in modified files

@GermanAizek
Copy link
Copy Markdown
Contributor Author

please update year in copyright header in modified files

fixed it this e2db055

Comment thread shared/source/os_interface/linux/drm_neo.cpp Outdated
Comment thread shared/source/os_interface/linux/drm_neo.cpp Outdated
VPG-SWE-Github pushed a commit that referenced this pull request May 11, 2026
Replace std::string::find/rfind/find_last_of(c) with the char overload
find/rfind/find_last_of('c') throughout the codebase. The string-literal
overload constructs a temporary std::string_view/string and scans for a
null terminator; the char overload skips both steps. Replace the one
strstr(s, c) call with strchr(s, 'c') for the same reason.

In Drm::discoverDevices, move the renderDeviceSuffix strlen and the
Os::pciDevicesDirectory length computation out of the inner loop body:
renderDeviceSuffix is now constexpr and its length is a constexpr
compile-time constant; pciDevicesDirectory length is computed once before
the loop via std::char_traits<char>::length.

#791
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
@JablonskiMateusz
Copy link
Copy Markdown
Contributor

covered within 756681d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants