diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api.rst | 2 | ||||
-rw-r--r-- | doc/changelog.rst | 24 | ||||
-rw-r--r-- | doc/misc_functions.rst | 16 | ||||
-rw-r--r-- | doc/socket_functions.rst | 18 | ||||
-rw-r--r-- | doc/string_formatter.rst | 9 |
5 files changed, 59 insertions, 10 deletions
diff --git a/doc/api.rst b/doc/api.rst index deb815f..5f009cc 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -9,6 +9,8 @@ Function reference ====== ====== ====== ======================================== RMV MinVer FirstA Name ====== ====== ====== ======================================== +4.9 4.9 4.9 HX_sockaddr_is_local +4.9 4.9 4.9 HX_ipaddr_is_local 4.7 4.7 4.7 HXQUOTE_BASE64IMAP 4.7 4.7 4.7 HXQUOTE_BASE64URL 4.3 4.3 4.3 HX_unit_seconds diff --git a/doc/changelog.rst b/doc/changelog.rst index 1894bf5..9a1590c 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,3 +1,27 @@ +v4.10 (2023-01-29) +================== + +Fixes: + +* format: plug a memory leak relating to func_entry_clone +* Resolve mingw build failure + + +v4.9 (2023-01-23) +================= + +Enhancements: + +* socket: add sockaddr_is_local, ipaddr_is_local functions + +Fixes: + +* format: avoid return value truncation from HXformat_aprintf, HXformat_sprintf +* format: avoid calling HXmc_length on a non-hxmc object +* format: add new variations of printf functions returning ssize_t +* Resolve Coverity-SCAN reports + + v4.8 (2022-12-03) ================= diff --git a/doc/misc_functions.rst b/doc/misc_functions.rst index 0f1bdaf..43dacfe 100644 --- a/doc/misc_functions.rst +++ b/doc/misc_functions.rst @@ -8,7 +8,6 @@ Miscellaneous functions int HX_ffs(unsigned long z); int HX_fls(unsigned long z); - void HX_hexdump(FILE *fp, const void *ptr, unsigned int len); void HX_zvecfree(char **); unsigned int HX_zveclen(const char *const *); @@ -21,11 +20,6 @@ Miscellaneous functions Finds the last (most-significant) bit in a value and returns its position, or ``-1`` to indicate failure. -``HX_hexdump`` - Outputs a nice pretty-printed hex and ASCII dump to the filedescriptor - ``fp``. ``ptr`` is the memory area, of which ``len`` bytes will be - dumped. - ``HX_zvecfree`` Frees the supplied Z-vector array. (Frees all array elements from the first element to (excluding) the first ``NULL`` element.) @@ -33,3 +27,13 @@ Miscellaneous functions ``HX_zveclen`` Counts the number of array elements until the first ``NULL`` array element is seen, and returns this number. + +.. code-block:: c + + #include <libHX/io.h> + void HX_hexdump(FILE *fp, const void *ptr, unsigned int len); + +``HX_hexdump`` + Outputs a nice pretty-printed hex and ASCII dump to the filedescriptor + ``fp``. ``ptr`` is the memory area, of which ``len`` bytes will be + dumped. diff --git a/doc/socket_functions.rst b/doc/socket_functions.rst index fe2b69d..ead0f08 100644 --- a/doc/socket_functions.rst +++ b/doc/socket_functions.rst @@ -7,6 +7,8 @@ Socket functions #include <libHX/socket.h> int HX_socket_from_env(const struct addrinfo *ai, const char *intf); + int HX_sockaddr_is_local(const struct sockaddr *, socklen_t, unsigned int flags); + int HX_ipaddr_is_local(const char *, unsigned int flags); ``HX_socket_from_env`` The function looks up the current process's file descriptors for a @@ -14,3 +16,19 @@ Socket functions (optionally) intf if the latter is not NULL``. Upon success, the fd number is returned, or -1 if no file descriptor matched. No errors are signalled. + +``HX_sockaddr_is_local`` + Attempts to determine if the given socket address refers to a local + address. This function may be helpful in determining whether a process + should spend any time (or not) on compressing data before sending to a + peer. The definition of "local" is generally dependent upon the network + APIs. The ``flags`` parameter can contain ``AI_V4MAPPED`` if + IPv4-mapped IPv6 addresses should be recognized. The function returns + >0 if the address is considered local, 0 if not, and any other + negative value for a system error that makes the result + indeterminate. + +``HX_ipaddr_is_local`` + Takes a text representation of an IPv6/IPv4 address and, after + transformation, calls ``HX_sockaddr_is_local``. ``flags`` and + return value behave the same as that. diff --git a/doc/string_formatter.rst b/doc/string_formatter.rst index fdb9c19..77badf8 100644 --- a/doc/string_formatter.rst +++ b/doc/string_formatter.rst @@ -116,10 +116,11 @@ Invoking the formatter Does substituion and directly outputs the expansion to the given stdio stream. -On success, the length of the expanded string is returned, excluding the -trailing ``\0``. While ``HXformat_sprintf`` will not write more than ``size`` -bytes (including the ``\0``), the length it would have taken is returned, -similar to what sprintf does. On error, ``-errno`` is returned. +On success, the length of the expanded string is returned (only up to a maximum +of SSIZE_MAX), excluding the trailing ``\0``. While ``HXformat_sprintf`` will +not write more than ``size`` bytes (including the ``\0``), the length it would +have taken is returned, similar to what sprintf does. On error, ``-errno`` is +returned. The HXformat function family recognizes make-style like functions and recursive expansion, described below. |