Skip to content

refactor: Fix bugprone-string-constructor warning - #28741

Merged
fanquake merged 1 commit into
bitcoin:masterfrom
maflcko:2310-bugprone-string-constructor-
Oct 30, 2023
Merged

fanquake merged 1 commit into
bitcoin:masterfrom
maflcko:2310-bugprone-string-constructor-

Conversation

@maflcko

@maflcko maflcko commented Oct 27, 2023

Copy link
Copy Markdown
Member

String literals in C++ have a trailing null character, so the current code is fine to rely on that implicitly. However,

  • the sqlite documentation explicitly mentions the null character
  • code readers may wonder if the code is intentional
  • clang-tidy warns about the code via bugprone-string-constructor

Address the points by putting the null character into the code and enable the clang-tidy bugprone-string-constructor check.

@DrahtBot

DrahtBot commented Oct 27, 2023 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK stickies-v
Stale ACK pablomartin4btc

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fa3b6ef3c736063a5d7e12456aacfc545a818d63

Comment thread src/wallet/db.cpp Resolved
@maflcko
maflcko force-pushed the 2310-bugprone-string-constructor- branch from fa3b6ef to fa56067 Compare October 30, 2023 13:59
@fanquake
fanquake requested a review from stickies-v October 30, 2023 14:06

@stickies-v stickies-v left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fa56067

Comment thread src/wallet/db.cpp Resolved
@fanquake
fanquake merged commit 4458ae8 into bitcoin:master Oct 30, 2023
@maflcko
maflcko deleted the 2310-bugprone-string-constructor- branch October 31, 2023 07:49
@bitcoin bitcoin locked and limited conversation to collaborators Oct 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants