Skip to content

Conversation

@Aniobodo
Copy link
Contributor

Changed Length >= newCapacity to Capacity >= newCapacity: checking with current capacity of the buffer.

Changed Length >= newCapacity to Capacity >= newCapacity: checking with current capacity of the buffer.
@sonarqubecloud
Copy link

@linkdotnet
Copy link
Owner

Oh that is a good one and much appreciated. @Joy-less I think that change Length >= newCapacity was unintentional?

Therefore the PR is justified. Given that we might resize too often at the moment.
@Aniobodo if you feel especially nice you can add an entry to the https://github.com/linkdotnet/StringBuilder/blob/main/CHANGELOG.md

Something under the UNRELEASED section:

## UNRELEASED

### CHANGED
- Optimized when the internal buffer should grow. Fixed by [@Aniobodo](https://github.com/Aniobodo)

@Joy-less
Copy link
Contributor

Sorry yes this is correct, my bad if I introduced this mistake. @linkdotnet
Easy to get confused between the two, since Length isn't actually the length of the buffer.

Aniobodo added a commit to Aniobodo/StringBuilder that referenced this pull request Feb 20, 2025
@linkdotnet
Copy link
Owner

Sorry yes this is correct, my bad if I introduced this mistake. @linkdotnet Easy to get confused between the two, since Length isn't actually the length of the buffer.

Easy - no need to apologize. I also didn't spot that. Just wanted to make sure that it wasn't intentional. Let's get that in - I will add the changelog entry.

@linkdotnet linkdotnet merged commit 6cb425d into linkdotnet:main Feb 20, 2025
3 checks passed
@Aniobodo Aniobodo deleted the patch-2 branch February 20, 2025 19:10
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.

3 participants