Skip to content

Conversation

@bagder
Copy link
Member

@bagder bagder commented Dec 30, 2025

No description provided.

@bagder bagder marked this pull request as ready for review December 30, 2025 23:14
@bagder bagder requested a review from Copilot December 30, 2025 23:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes the proto2num() function by replacing a dynamically allocated protoset array with a stack-allocated one, eliminating a malloc/free pair. The change introduces a compile-time maximum protocol count (MAX_PROTOS) and uses a debug assertion to enforce this limit.

Key changes:

  • Introduced MAX_PROTOS constant (set to 30) to define the maximum number of protocols
  • Replaced dynamic allocation of protoset with stack allocation using the new constant
  • Removed the corresponding curlx_free() call and allocation failure check

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bagder bagder force-pushed the bagder/proto2num-less-alloc branch from 0660d1b to caf8d44 Compare December 31, 2025 16:31
@bagder bagder closed this in 0c278cd Dec 31, 2025
@bagder bagder deleted the bagder/proto2num-less-alloc branch December 31, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant