Home GnuPG
Diffusion GnuPG fc4834d213af

dirmngr: Refactor variable-sized array code.

Description

dirmngr: Refactor variable-sized array code.

* dirmngr/ks-engine-hkp.c (struct hostinfo_s): Add explicit length and
size fields.
(MAX_POOL_SIZE): New macro.
(create_new_hostinfo): Initialize new fields.
(host_in_pool_p): Adapt.
(select_random_host): Likewise.
(add_host): Likewise.  Move the resizing logic here.
(hostinfo_sort_pool): New function.
(map_host): Simplify.  Move the resizing logic away from here.
(ks_hkp_mark_host): Adapt.
(ks_hkp_print_hosttable): Likewise.

The current code assumes that the pool array is only filled when the
hostinfo object is created. This patch removes that limitation.

  • GnuPG-bug-id: T3033
  • Signed-off-by: Justus Winter <justus@g10code.com>

Details

Provenance
justusAuthored on Jun 20 2017, 2:54 PM
Parents
rG794261c4bdb2: dirmngr: Fix typo.
Branches
Unknown
Tags
Unknown
Tasks
T3033: bug: dirmngr latches SRV port cross-scheme