.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* IIO - useful set of util functionality |
---|
2 | 3 | * |
---|
3 | 4 | * Copyright (c) 2008 Jonathan Cameron |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify it |
---|
6 | | - * under the terms of the GNU General Public License version 2 as published by |
---|
7 | | - * the Free Software Foundation. |
---|
8 | 5 | */ |
---|
9 | 6 | #include <string.h> |
---|
10 | 7 | #include <stdlib.h> |
---|
.. | .. |
---|
546 | 543 | { |
---|
547 | 544 | int count = 0; |
---|
548 | 545 | |
---|
| 546 | + /* It takes a digit to represent zero */ |
---|
| 547 | + if (!num) |
---|
| 548 | + return 1; |
---|
| 549 | + |
---|
549 | 550 | while (num != 0) { |
---|
550 | 551 | num /= 10; |
---|
551 | 552 | count++; |
---|