From: Vladimír Čunát Date: Thu, 22 Nov 2018 16:43:15 +0000 (+0100) Subject: lib/utils: more docs X-Git-Tag: v3.2.1~11^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=820766dbbb13aa1afb4c2d09e20eaa46cb8f5207;p=thirdparty%2Fknot-resolver.git lib/utils: more docs It's perhaps unfortunate that the output value of buflen had +1 change in meaning in commit 19a3cad69, but the name clearly indicates that we care about length of the buffer, i.e. space terminating zero *is* counted on input, so let's be consistent and count it on output as well. --- diff --git a/lib/utils.h b/lib/utils.h index 0ec283b0c..8e4e1ad4b 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -281,9 +281,14 @@ uint16_t kr_inaddr_port(const struct sockaddr *addr); /** Set port. */ KR_EXPORT void kr_inaddr_set_port(struct sockaddr *addr, uint16_t port); -/** String representation for given address as "#" */ + +/** Write string representation for given address as "#". + * \param[in] addr the raw address + * \param[out] buf the buffer for output string + * \param[in,out] buflen the available(in) and utilized(out) length, including \0 */ KR_EXPORT int kr_inaddr_str(const struct sockaddr *addr, char *buf, size_t *buflen); + /** Return address type for string. */ KR_EXPORT KR_PURE int kr_straddr_family(const char *addr);