diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-05-26 13:32:11 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-05-26 16:17:33 +0200 |
commit | 3dfeb0449189c6610fa46342389fdf434483b87e (patch) | |
tree | ce4d18e776686e319dd5f0a94c892fa5e9f7d1af /src/basic/hexdecoct.c | |
parent | man: document udevadm info output prefixes (diff) | |
download | systemd-3dfeb0449189c6610fa46342389fdf434483b87e.tar.xz systemd-3dfeb0449189c6610fa46342389fdf434483b87e.zip |
hexdecoct: make return parameters of unbase64mem() and unhexmem() optional
Inspired by: #19059
Diffstat (limited to '')
-rw-r--r-- | src/basic/hexdecoct.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/basic/hexdecoct.c b/src/basic/hexdecoct.c index cb0104670f..a5edccad20 100644 --- a/src/basic/hexdecoct.c +++ b/src/basic/hexdecoct.c @@ -115,8 +115,6 @@ int unhexmem_full(const char *p, size_t l, bool secure, void **ret, size_t *ret_ uint8_t *z; int r; - assert(ret); - assert(ret_len); assert(p || l == 0); if (l == SIZE_MAX) @@ -150,8 +148,10 @@ int unhexmem_full(const char *p, size_t l, bool secure, void **ret, size_t *ret_ *z = 0; - *ret_len = (size_t) (z - buf); - *ret = TAKE_PTR(buf); + if (ret_len) + *ret_len = (size_t) (z - buf); + if (ret) + *ret = TAKE_PTR(buf); return 0; @@ -705,8 +705,6 @@ int unbase64mem_full(const char *p, size_t l, bool secure, void **ret, size_t *r int r; assert(p || l == 0); - assert(ret); - assert(ret_size); if (l == SIZE_MAX) l = strlen(p); @@ -802,8 +800,10 @@ int unbase64mem_full(const char *p, size_t l, bool secure, void **ret, size_t *r *z = 0; - *ret_size = (size_t) (z - buf); - *ret = TAKE_PTR(buf); + if (ret_size) + *ret_size = (size_t) (z - buf); + if (ret) + *ret = TAKE_PTR(buf); return 0; |