Skip to content

thrdqueue: drop name strdups from Curl_thrdq_create - #22555

Closed
bagder wants to merge 2 commits into
masterfrom
bagder/treadq-name
Closed

bagder wants to merge 2 commits into
masterfrom
bagder/treadq-name

Conversation

@bagder

@bagder bagder commented Aug 12, 2026

Copy link
Copy Markdown
Member

The only usage of the thread queue and pool is for "DNS" which is a static string. No point in strdup'ing it (twice). Future users are likely to also use fixed strings, otherwise we revert this change when dynamic names are introduced.

Reported-by: Max Dymond

The only usage of the thread queue and pool is for "DNS" which is a
static string. No point in strdup'ing it (twice). Future users are
*likely* to also used fixed strings, otherwise we revert this change
when dynamic names are introduced.

Reported-by: Max Dymond
@github-actions github-actions Bot added the name lookup DNS and related tech label Aug 12, 2026
@bagder
bagder requested review from icing and a lite review from Copilot August 12, 2026 10:14
@bagder
bagder marked this pull request as ready for review August 12, 2026 10:14

Copilot AI left a comment

Copy link
Copy Markdown

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 removes duplicated allocations of thread queue/pool name strings by treating them as long-lived constants, reducing unnecessary strdup/free overhead in the threaded DNS resolver’s queue/pool setup.

Changes:

  • Store name in struct curl_thrdq as const char * and stop duplicating/freeing it.
  • Store name in struct curl_thrdpool as const char * and stop duplicating/freeing it.

Reviewed changes

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

File Description
lib/thrdqueue.c Switch queue name storage to non-owning const char * and remove cleanup/free of the duplicated name.
lib/thrdpool.c Switch pool name storage to non-owning const char * and remove cleanup/free of the duplicated name.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/thrdqueue.c
Comment thread lib/thrdpool.c
@bagder bagder closed this in d064bc2 Aug 12, 2026
@bagder
bagder deleted the bagder/treadq-name branch August 12, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

name lookup DNS and related tech

Development

Successfully merging this pull request may close these issues.

3 participants