CLEANUP: log: use strnlen2() in _lf_text_len() to compute string length

Thanks to previous commit, we can now use strnlen2() function to perform
strnlen() portable equivalent instead of re-implementing the logic under
_lf_text_len() function.
This commit is contained in:
Aurelien DARRAGON 2024-10-25 17:06:30 +02:00
parent 24131dee30
commit 6d5b32daad
1 changed files with 1 additions and 9 deletions

View File

@ -2388,15 +2388,7 @@ static inline char *_lf_text_len(char *dst, const char *src,
* indefinite length text in cbor, because indefinite-length text
* has to be made of multiple chunks of known size as per RFC8949...
*/
{
int _len;
/* strnlen(src, len) portable equivalent: */
for (_len = 0; _len < len && src[_len]; _len++)
;
len = _len;
}
len = strnlen2(src, len);
ret = cbor_encode_text(&ctx->encode.cbor, dst, dst + size, src, len);
if (ret == NULL)