Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eventsub/string): minor cleanups #5973

Merged
merged 3 commits into from
Feb 22, 2025

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Feb 22, 2025

Followup to #5968.

  • We can't make the constructor taking a std::string_view constexpr, because we can store a QString which isn't constexpr → our destructor isn't constexpr.
  • The constructor should be a bit simpler now - it shows what we're doing (if we can't fit data in-place, we allocate, and then copy the data)
  • view() can be constexpr (not sure what the use is)
  • length was never used
  • We don't need to clear the storage when moving, because we clear the flags (0 = empty string). In debug mode however, I'd like to make sure it's actually never used, so we put a tombstone value there (if we'd access it, we'd get garbage).
  • For clang-20, we need to cast the argument to std::mem* functions to void* explicitly - otherwise, it warns that the type isn't trivially copyable. It doesn't know that (1) we're moving and (2) QString is trivially relocatable (memcpy-able).
  • Added some tests to make sure that the underlying QString is actually destructed (similar to chore(tests): try to generate coverage better #5972).

@pajlada pajlada enabled auto-merge (squash) February 22, 2025 12:24
@pajlada pajlada merged commit 22c6c8d into Chatterino:master Feb 22, 2025
16 checks passed
@Nerixyz Nerixyz deleted the fix/string-stuff branch February 22, 2025 13:59
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