mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
Do not call strlen for every character in the log entry
This commit is contained in:
parent
88053bd1ca
commit
d9eba0e924
1 changed files with 3 additions and 1 deletions
|
@ -255,8 +255,10 @@ void logv(struct log *log, enum log_level level, const char *fmt, va_list ap)
|
|||
|
||||
l->log = tal_vfmt(l, fmt, ap);
|
||||
|
||||
size_t log_len = strlen(l->log);
|
||||
|
||||
/* Sanitize any non-printable characters, and replace with '?' */
|
||||
for (size_t i=0; i<strlen(l->log); i++)
|
||||
for (size_t i=0; i<log_len; i++)
|
||||
if (l->log[i] < ' ' || l->log[i] >= 0x7f)
|
||||
l->log[i] = '?';
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue