From 705bda859ed8bbdd753d587b9814de4af3afee80 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 19 Jun 2019 08:15:13 -0400 Subject: Add unit tests for the unitparse.c module. --- src/lib/confmgt/unitparse.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/lib/confmgt') diff --git a/src/lib/confmgt/unitparse.c b/src/lib/confmgt/unitparse.c index 906195259d..c3ed8285a4 100644 --- a/src/lib/confmgt/unitparse.c +++ b/src/lib/confmgt/unitparse.c @@ -128,10 +128,14 @@ config_parse_units(const char *val, const unit_table_t *u, int *ok) use_float = 1; } - if (!cp) { + if (BUG(!cp)) { + // cp should always be non-NULL if the parse operation succeeds. + + // LCOV_EXCL_START *ok = 1; v = use_float ? ((uint64_t)d) : v; goto done; + // LCOV_EXCL_STOP } cp = (char*) eat_whitespace(cp); -- cgit v1.2.3-54-g00ecf