util/charset: Rename utf16_len() to utf16_null_terminated_len()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Wed, 8 Nov 2023 23:36:21 +0000 (12:36 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 15 Nov 2023 22:07:36 +0000 (22:07 +0000)
The new name indicates that — contrary to functions such as strnlen() —
the length may include the terminator.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/util/charset/charset.h
lib/util/charset/util_unistr.c

index df8aa0de8626bdfe67843addee747547bbbf2331..f350e748c07911e367051fe9c2cda19e9de92a2f 100644 (file)
@@ -107,7 +107,7 @@ size_t ucs2_align(const void *base_ptr, const void *p, int flags);
 return the number of bytes occupied by a buffer in CH_UTF16 format
 the result includes the null termination
 **/
-size_t utf16_len(const void *buf);
+size_t utf16_null_terminated_len(const void *buf);
 
 /**
 return the number of bytes occupied by a buffer in CH_UTF16 format
index 260692aceacb2d9ddd341e35eb4fa9a37b29790c..c94068819ce74c17a4742e1cdec425a7b3c2346a 100644 (file)
@@ -195,7 +195,7 @@ size_t ucs2_align(const void *base_ptr, const void *p, int flags)
 return the number of bytes occupied by a buffer in CH_UTF16 format
 the result includes the null termination
 **/
-size_t utf16_len(const void *buf)
+size_t utf16_null_terminated_len(const void *buf)
 {
        size_t len;
 
@@ -501,7 +501,7 @@ static size_t pull_ucs2(char *dest, const void *src, size_t dest_len, size_t src
 
        if (flags & STR_TERMINATE) {
                if (src_len == (size_t)-1) {
-                       src_len = utf16_len(src);
+                       src_len = utf16_null_terminated_len(src);
                } else {
                        src_len = utf16_null_terminated_len_n(src, src_len);
                }