parse-util: make return parameter optional in safe_atou16_full()
authorLennart Poettering <lennart@poettering.net>
Mon, 1 Jun 2020 15:10:27 +0000 (17:10 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 27 Jul 2020 08:26:32 +0000 (10:26 +0200)
All other safe_atoXYZ_full() functions have the parameter optional,
let's make it optoinal here, too.

(cherry picked from commit aa85e4d3cef8ca8436e480bce9fa4ce72876b636)

src/basic/parse-util.c

index cb785db5170906fb1a1e906915ebf833507c568a..7bfad57a6386f345a6ae18a00bd2cc75a43a409b 100644 (file)
@@ -521,7 +521,9 @@ int safe_atou16_full(const char *s, unsigned base, uint16_t *ret) {
         if ((unsigned long) (uint16_t) l != l)
                 return -ERANGE;
 
-        *ret = (uint16_t) l;
+        if (ret)
+                *ret = (uint16_t) l;
+
         return 0;
 }