OSDN Git Service

throttle: use THROTTLE_MAX/ARRAY_SIZE for hard code
authorzhenwei pi <pizhenwei@bytedance.com>
Fri, 28 Jul 2023 02:20:04 +0000 (10:20 +0800)
committerHanna Czenczek <hreitz@redhat.com>
Tue, 29 Aug 2023 08:49:24 +0000 (10:49 +0200)
commit7017313882e39b6285e1a47dc474a395ba6f0e7d
tree2a1ff97c9157ed941d84c23b3b215c0bdc27f098
parente76f201f69e76653f3e7301f2183421d9267e2f5
throttle: use THROTTLE_MAX/ARRAY_SIZE for hard code

The first dimension of both to_check and
bucket_types_size/bucket_types_units is used as throttle direction,
use THROTTLE_MAX instead of hard coded number. Also use ARRAY_SIZE()
to avoid hard coded number for the second dimension.

Hanna noticed that the two array should be static. Yes, turn them
into static variables.

Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230728022006.1098509-8-pizhenwei@bytedance.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
util/throttle.c