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

eval: remove superfluous strdup #11620

Merged
merged 1 commit into from
Oct 1, 2024
Merged

eval: remove superfluous strdup #11620

merged 1 commit into from
Oct 1, 2024

Conversation

NaN-git
Copy link

@NaN-git NaN-git commented Sep 30, 2024

Motivation

Remove the call of the dupString() function and replace it by makeImmutableString() because the string length of a std::string is known. This saves an implicit call of strlen() and enables code de-duplication.

Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

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

Description checks out.
Indeed allocation + memcpy should be quicker than a strdup, and it's a nice little cleanup.

@roberth roberth merged commit dc89eab into NixOS:master Oct 1, 2024
11 checks passed
@roberth
Copy link
Member

roberth commented Oct 1, 2024

Thanks!

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