From 743fc4a3c3bedb4f3061fb61ef4129e7c46c53a0 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 11 Sep 2016 22:25:01 +0900 Subject: [PATCH] Use the similar naming scheme for table size as 392256e542ad4202360fb94c87c155309473aa6e --- lib/includes/nghttp2/nghttp2.h | 36 ++++++++++++++++++---------------- lib/nghttp2_hd.c | 26 ++++++++++++------------ lib/nghttp2_hd.h | 4 ++-- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index d1ec9dea..c7a75d57 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -4596,7 +4596,7 @@ typedef struct nghttp2_hd_deflater nghttp2_hd_deflater; * * Initializes |*deflater_ptr| for deflating name/values pairs. * - * The |deflate_hd_table_bufsize_max| is the upper bound of header + * The |max_deflate_dynamic_table_size| is the upper bound of header * table size the deflater will use. * * If this function fails, |*deflater_ptr| is left untouched. @@ -4607,8 +4607,9 @@ typedef struct nghttp2_hd_deflater nghttp2_hd_deflater; * :enum:`NGHTTP2_ERR_NOMEM` * Out of memory. */ -NGHTTP2_EXTERN int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr, - size_t deflate_hd_table_bufsize_max); +NGHTTP2_EXTERN int +nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr, + size_t max_deflate_dynamic_table_size); /** * @function @@ -4625,9 +4626,10 @@ NGHTTP2_EXTERN int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr, * The library code does not refer to |mem| pointer after this * function returns, so the application can safely free it. */ -NGHTTP2_EXTERN int nghttp2_hd_deflate_new2(nghttp2_hd_deflater **deflater_ptr, - size_t deflate_hd_table_bufsize_max, - nghttp2_mem *mem); +NGHTTP2_EXTERN int +nghttp2_hd_deflate_new2(nghttp2_hd_deflater **deflater_ptr, + size_t max_deflate_dynamic_table_size, + nghttp2_mem *mem); /** * @function @@ -4640,18 +4642,18 @@ NGHTTP2_EXTERN void nghttp2_hd_deflate_del(nghttp2_hd_deflater *deflater); * @function * * Changes header table size of the |deflater| to - * |settings_hd_table_bufsize_max| bytes. This may trigger eviction + * |settings_max_dynamic_table_size| bytes. This may trigger eviction * in the dynamic table. * - * The |settings_hd_table_bufsize_max| should be the value received in - * SETTINGS_HEADER_TABLE_SIZE. + * The |settings_max_dynamic_table_size| should be the value received + * in SETTINGS_HEADER_TABLE_SIZE. * * The deflater never uses more memory than - * ``deflate_hd_table_bufsize_max`` bytes specified in + * ``max_deflate_dynamic_table_size`` bytes specified in * `nghttp2_hd_deflate_new()`. Therefore, if - * |settings_hd_table_bufsize_max| > ``deflate_hd_table_bufsize_max``, - * resulting maximum table size becomes - * ``deflate_hd_table_bufsize_max``. + * |settings_max_dynamic_table_size| > + * ``max_deflate_dynamic_table_size``, resulting maximum table size + * becomes ``max_deflate_dynamic_table_size``. * * This function returns 0 if it succeeds, or one of the following * negative error codes: @@ -4661,7 +4663,7 @@ NGHTTP2_EXTERN void nghttp2_hd_deflate_del(nghttp2_hd_deflater *deflater); */ NGHTTP2_EXTERN int nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater, - size_t settings_hd_table_bufsize_max); + size_t settings_max_dynamic_table_size); /** * @function @@ -4832,8 +4834,8 @@ NGHTTP2_EXTERN void nghttp2_hd_inflate_del(nghttp2_hd_inflater *inflater); * Changes header table size in the |inflater|. This may trigger * eviction in the dynamic table. * - * The |settings_hd_table_bufsize_max| should be the value transmitted - * in SETTINGS_HEADER_TABLE_SIZE. + * The |settings_max_dynamic_table_size| should be the value + * transmitted in SETTINGS_HEADER_TABLE_SIZE. * * This function must not be called while header block is being * inflated. In other words, this function must be called after @@ -4854,7 +4856,7 @@ NGHTTP2_EXTERN void nghttp2_hd_inflate_del(nghttp2_hd_inflater *inflater); */ NGHTTP2_EXTERN int nghttp2_hd_inflate_change_table_size(nghttp2_hd_inflater *inflater, - size_t settings_hd_table_bufsize_max); + size_t settings_max_dynamic_table_size); /** * @enum diff --git a/lib/nghttp2_hd.c b/lib/nghttp2_hd.c index 275c966c..87abb3c4 100644 --- a/lib/nghttp2_hd.c +++ b/lib/nghttp2_hd.c @@ -684,7 +684,7 @@ int nghttp2_hd_deflate_init(nghttp2_hd_deflater *deflater, nghttp2_mem *mem) { } int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater, - size_t deflate_hd_table_bufsize_max, + size_t max_deflate_dynamic_table_size, nghttp2_mem *mem) { int rv; rv = hd_context_init(&deflater->ctx, mem); @@ -694,14 +694,14 @@ int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater, hd_map_init(&deflater->map); - if (deflate_hd_table_bufsize_max < NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE) { + if (max_deflate_dynamic_table_size < NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE) { deflater->notify_table_size_change = 1; - deflater->ctx.hd_table_bufsize_max = deflate_hd_table_bufsize_max; + deflater->ctx.hd_table_bufsize_max = max_deflate_dynamic_table_size; } else { deflater->notify_table_size_change = 0; } - deflater->deflate_hd_table_bufsize_max = deflate_hd_table_bufsize_max; + deflater->deflate_hd_table_bufsize_max = max_deflate_dynamic_table_size; deflater->min_hd_table_bufsize_max = UINT32_MAX; return 0; @@ -1225,9 +1225,9 @@ static void hd_context_shrink_table_size(nghttp2_hd_context *context, } } -int nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater, - size_t settings_hd_table_bufsize_max) { - size_t next_bufsize = nghttp2_min(settings_hd_table_bufsize_max, +int nghttp2_hd_deflate_change_table_size( + nghttp2_hd_deflater *deflater, size_t settings_max_dynamic_table_size) { + size_t next_bufsize = nghttp2_min(settings_max_dynamic_table_size, deflater->deflate_hd_table_bufsize_max); deflater->ctx.hd_table_bufsize_max = next_bufsize; @@ -1241,8 +1241,8 @@ int nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater, return 0; } -int nghttp2_hd_inflate_change_table_size(nghttp2_hd_inflater *inflater, - size_t settings_hd_table_bufsize_max) { +int nghttp2_hd_inflate_change_table_size( + nghttp2_hd_inflater *inflater, size_t settings_max_dynamic_table_size) { switch (inflater->state) { case NGHTTP2_HD_STATE_EXPECT_TABLE_SIZE: case NGHTTP2_HD_STATE_INFLATE_START: @@ -1258,16 +1258,16 @@ int nghttp2_hd_inflate_change_table_size(nghttp2_hd_inflater *inflater, strictly smaller than the current negotiated maximum size, encoder must send dynamic table size update. In other cases, we cannot expect it to do so. */ - if (inflater->ctx.hd_table_bufsize_max > settings_hd_table_bufsize_max) { + if (inflater->ctx.hd_table_bufsize_max > settings_max_dynamic_table_size) { inflater->state = NGHTTP2_HD_STATE_EXPECT_TABLE_SIZE; /* Remember minimum value, and validate that encoder sends the value less than or equal to this. */ - inflater->min_hd_table_bufsize_max = settings_hd_table_bufsize_max; + inflater->min_hd_table_bufsize_max = settings_max_dynamic_table_size; } - inflater->settings_hd_table_bufsize_max = settings_hd_table_bufsize_max; + inflater->settings_hd_table_bufsize_max = settings_max_dynamic_table_size; - inflater->ctx.hd_table_bufsize_max = settings_hd_table_bufsize_max; + inflater->ctx.hd_table_bufsize_max = settings_max_dynamic_table_size; hd_context_shrink_table_size(&inflater->ctx, NULL); return 0; diff --git a/lib/nghttp2_hd.h b/lib/nghttp2_hd.h index 1da9eb58..42b07c68 100644 --- a/lib/nghttp2_hd.h +++ b/lib/nghttp2_hd.h @@ -288,7 +288,7 @@ int nghttp2_hd_deflate_init(nghttp2_hd_deflater *deflater, nghttp2_mem *mem); /* * Initializes |deflater| for deflating name/values pairs. * - * The encoder only uses up to |deflate_hd_table_bufsize_max| bytes + * The encoder only uses up to |max_deflate_dynamic_table_size| bytes * for header table even if the larger value is specified later in * nghttp2_hd_change_table_size(). * @@ -299,7 +299,7 @@ int nghttp2_hd_deflate_init(nghttp2_hd_deflater *deflater, nghttp2_mem *mem); * Out of memory. */ int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater, - size_t deflate_hd_table_bufsize_max, + size_t max_deflate_dynamic_table_size, nghttp2_mem *mem); /*