Skip to content

Commit

Permalink
get_padding_length: Use simpler while logic
Browse files Browse the repository at this point in the history
  • Loading branch information
cdown committed Nov 9, 2024
1 parent 3c87365 commit 7d6e821
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/clipmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ static char **dmenu_user_argv;
* Calculate the base 10 padding length for a number.
*/
static int get_padding_length(size_t num) {
int digits = 0;
do {
num /= 10;
int digits = 1;
while (num /= 10) {
digits++;
} while (num > 0);
}
return digits;
}

Expand Down

0 comments on commit 7d6e821

Please sign in to comment.