|
Description
|
During the code review for CR 6478299, it was pointed out that the integration of strnlen would simplify lib/libc/port/print/doprnt.c:
/*
* XPG4 behavior - count
* precision as bytes.
* We don't use strlen() because
* the given char string may not
* be null-terminated.
*/
char *qp;
qp = memchr(bp, '\0', prec);
if (qp == NULL) {
p = bp + prec;
} else {
p = qp;
}
Could be rewritten as:
p = bp + strnlen(bp, (size_t) prec);
|