mirror of
https://github.com/curl/curl.git
synced 2026-08-25 17:23:37 +03:00
lib: optimize struct layouts for reduced memory usage
struct SingleRequest tweaks - 'upgr101' from enum upgrade101 => 'unsigned char', saves three bytes - made some 'unsigned char' => uint8_t - moved 'io_flags' to fill a hole on 64-bit arch struct UserDefined tweaks - Sort the fields by size. Larger to smaller. Helps avoding holes. - httpsig_algorithm moved - FTP uint8_t fields moved - new_file_perms moved - rtspreq moved - sort fields on size - urldata: drop 'struct Curl_data_priority' It only had a single struct member 'weight'. Use that directly instead to save indirections and struct alignments. Move field for size order. - urldata: move the RTSP fields in the UrlState struct to be ordered by size struct PureInfo tweaks - make 'pxcode' a uint8_t - move 'conn_protocol' to fill a hole - sort 'struct PureInfo' fields by size Closes #22585
This commit is contained in:
parent
7103a93b05
commit
fe703df949
6 changed files with 67 additions and 74 deletions
17
lib/http2.c
17
lib/http2.c
|
|
@ -704,7 +704,7 @@ static struct Curl_easy *h2_duphandle(struct Curl_cfilter *cf,
|
|||
if(second) {
|
||||
struct h2_stream_ctx *second_stream;
|
||||
http2_data_setup(cf, second, &second_stream);
|
||||
second->state.priority.weight = data->state.priority.weight;
|
||||
second->state.weight = data->state.weight;
|
||||
if(data->share)
|
||||
(void)Curl_share_easy_link(second, data->share);
|
||||
}
|
||||
|
|
@ -1757,15 +1757,15 @@ out:
|
|||
static int sweight_wanted(const struct Curl_easy *data)
|
||||
{
|
||||
/* 0 weight is not set by user and we take the nghttp2 default one */
|
||||
return data->set.priority.weight ?
|
||||
data->set.priority.weight : NGHTTP2_DEFAULT_WEIGHT;
|
||||
return data->set.weight ?
|
||||
data->set.weight : NGHTTP2_DEFAULT_WEIGHT;
|
||||
}
|
||||
|
||||
static int sweight_in_effect(const struct Curl_easy *data)
|
||||
{
|
||||
/* 0 weight is not set by user and we take the nghttp2 default one */
|
||||
return data->state.priority.weight ?
|
||||
data->state.priority.weight : NGHTTP2_DEFAULT_WEIGHT;
|
||||
return data->state.weight ?
|
||||
data->state.weight : NGHTTP2_DEFAULT_WEIGHT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1777,10 +1777,9 @@ static int sweight_in_effect(const struct Curl_easy *data)
|
|||
static void h2_pri_spec(struct Curl_easy *data,
|
||||
nghttp2_priority_spec *pri_spec)
|
||||
{
|
||||
struct Curl_data_priority *prio = &data->set.priority;
|
||||
nghttp2_priority_spec_init(pri_spec, 0,
|
||||
sweight_wanted(data), FALSE);
|
||||
data->state.priority = *prio;
|
||||
int prio = data->set.weight;
|
||||
nghttp2_priority_spec_init(pri_spec, 0, sweight_wanted(data), FALSE);
|
||||
data->state.weight = prio;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue