Skip to content

Initialize enum name string pointers with the empty string upfront. - #29253

Draft
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_966841732
Draft

Initialize enum name string pointers with the empty string upfront.#29253
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_966841732

Conversation

@copybara-service

Copy link
Copy Markdown

Initialize enum name string pointers with the empty string upfront.

This replaces the post-processing loop that filled null pointers with the empty string by pre-filling the allocated array using std::fill before populating the enum names. This avoids O(n) comparisons, and also avoids assuming that the array is initialized with nullptr instead of garbage data.

This replaces the post-processing loop that filled null pointers with the empty string by pre-filling the allocated array using std::fill before populating the enum names. This avoids O(n) comparisons, and also avoids assuming that the array is initialized with nullptr instead of garbage data.

PiperOrigin-RevId: 966841732
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.

1 participant