From 25d65e85274b4eb788be1dda8781625ec35dc4a9 Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Wed, 31 May 2023 14:53:07 +0100 Subject: [PATCH] Refactor while loop for simplicity Signed-off-by: David Horstmann --- library/oid.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library/oid.c b/library/oid.c index d2efbed1fe..ea1e70bf09 100644 --- a/library/oid.c +++ b/library/oid.c @@ -915,14 +915,13 @@ static int oid_parse_number(unsigned int *num, const char **p, const char *bound static size_t oid_subidentifier_num_bytes(unsigned int value) { - size_t num_bytes = 1; + size_t num_bytes = 0; - value >>= 7; - - while (value != 0) { - num_bytes++; + do { value >>= 7; - } + num_bytes++; + } while (value != 0); + return num_bytes; }