
On Tue, Feb 09, 2021 at 09:19:48 +0000, BiaoxiangYe wrote:
From: BiaoXiang Ye <yebiaoxiang@huawei.com>
Use macro instead of magic number, keep the style consistent with MICROSEC_PER_SEC.
I'm not sure where's the magic in converting seconds to milliseconds or microseconds to seconds. However, I can see it's a bit easier to spot we're converting seconds and milliseconds rather than milliseconds and microseconds, for example.
Signed-off-by: BiaoXiang Ye <yebiaoxiang@huawei.com> --- src/rpc/virkeepalive.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c index 786f9038ef..baea2e6478 100644 --- a/src/rpc/virkeepalive.c +++ b/src/rpc/virkeepalive.c @@ -32,6 +32,7 @@
#define VIR_FROM_THIS VIR_FROM_RPC #define MICROSEC_PER_SEC (1000 * 1000) +#define MILLISECONDS_PER_SECOND (1000) VIR_LOG_INIT("rpc.keepalive");
Please, keep the empty line above VIR_LOG_INIT. MICROSEC_PER_SEC vs MILLISECONDS_PER_SECOND definitely don't use consistent style. Ideally you could use G_USEC_PER_SEC as Jonathon suggested, but I'm afraid there's no corresponding G_MSEC_PER_SEC to be used in this patch. I guess G_USEC_PER_SEC and VIR_MSEC_PER_SEC could be usable as a workaround... Or just use numbers instead of both macros, they are quite clear anyway. Jirka