Skip to content

Conversation

@bagder
Copy link
Member

@bagder bagder commented Dec 7, 2025

No description provided.

@github-actions github-actions bot added the HTTP label Dec 7, 2025
@bagder bagder marked this pull request as ready for review December 7, 2025 11:28
@bagder
Copy link
Member Author

bagder commented Dec 7, 2025

augment review

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

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 memory allocation for HSTS entries by using a flexible array member pattern instead of separate allocations for the structure and hostname string. This reduces allocation overhead from two malloc calls to one per entry.

  • Converted stsentry structure from using a separate const char *host pointer to an inline flexible array member char host[1]
  • Simplified memory management by consolidating allocation and deallocation into single operations
  • Removed unnecessary const-casting since the host field is now mutable by design

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/hsts.h Changed stsentry structure to use flexible array member char host[1] instead of const char *host pointer
lib/hsts.c Updated allocation to single calloc with extra space for hostname, simplified deallocation to macro, removed CURL_UNCONST cast

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

@bagder bagder closed this in 9ec63d8 Dec 7, 2025
@bagder bagder deleted the bagder/hsts-less-alloc branch December 7, 2025 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant