diff mbox series

[ndctl,30/36] ndctl/util: Return 0 for NULL arguments to parse_size64()

Message ID 158300776469.2141307.15515797714915897057.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show
Series Multiple topics / backlog for v68 | expand

Commit Message

Dan Williams Feb. 29, 2020, 8:22 p.m. UTC
Allow callers to skip their own NULL checks and just assume that
parse_size64() handles the NULL case.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 util/size.c |    2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/util/size.c b/util/size.c
index f54ae5b870b8..6efa91f6eef9 100644
--- a/util/size.c
+++ b/util/size.c
@@ -65,5 +65,7 @@  unsigned long long __parse_size64(const char *str, unsigned long long *units)
 
 unsigned long long parse_size64(const char *str)
 {
+	if (!str)
+		return 0;
 	return __parse_size64(str, NULL);
 }