sd-id128: handle NULL return parameter in sd_id128_from_string() nicer

If the return parameter is NULL, simply validate the string, and return no
error.
This commit is contained in:
Lennart Poettering
2016-07-22 12:59:36 +02:00
parent e042eab720
commit 9ca8d43479
2 changed files with 7 additions and 9 deletions
+2 -2
View File
@@ -52,7 +52,6 @@ _public_ int sd_id128_from_string(const char s[], sd_id128_t *ret) {
bool is_guid = false;
assert_return(s, -EINVAL);
assert_return(ret, -EINVAL);
for (n = 0, i = 0; n < 16;) {
int a, b;
@@ -90,7 +89,8 @@ _public_ int sd_id128_from_string(const char s[], sd_id128_t *ret) {
if (s[i] != 0)
return -EINVAL;
*ret = t;
if (ret)
*ret = t;
return 0;
}