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:
parent
24131dee30
commit
6d5b32daad
10
src/log.c
10
src/log.c
@ -2388,15 +2388,7 @@ static inline char *_lf_text_len(char *dst, const char *src,
|
|||||||
* indefinite length text in cbor, because indefinite-length text
|
* indefinite length text in cbor, because indefinite-length text
|
||||||
* has to be made of multiple chunks of known size as per RFC8949...
|
* has to be made of multiple chunks of known size as per RFC8949...
|
||||||
*/
|
*/
|
||||||
{
|
len = strnlen2(src, len);
|
||||||
int _len;
|
|
||||||
|
|
||||||
/* strnlen(src, len) portable equivalent: */
|
|
||||||
for (_len = 0; _len < len && src[_len]; _len++)
|
|
||||||
;
|
|
||||||
|
|
||||||
len = _len;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = cbor_encode_text(&ctx->encode.cbor, dst, dst + size, src, len);
|
ret = cbor_encode_text(&ctx->encode.cbor, dst, dst + size, src, len);
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user