StrScan(): Copy into new buffer with MemCopy() instead of a loop

This commit is contained in:
Michael Mikonos 2024-01-30 21:48:54 +08:00
parent 524bddec6c
commit 8e5f169218

View file

@ -242,7 +242,7 @@ and take address.
*/ */
U8 *buf, *ptr, **pptr; U8 *buf, *ptr, **pptr;
Bool left_justify = FALSE; Bool left_justify = FALSE;
I64 ch, cur_arg = 0, i, len, *i_ptr, dec_len; I64 ch, cur_arg = 0, len, *i_ptr, dec_len;
F64 *d_ptr; F64 *d_ptr;
if (!format) if (!format)
@ -301,9 +301,9 @@ and take address.
} }
} }
buf = MAlloc(len + 1); buf = MAlloc(len + 1);
for (i = 0; i < len; i++) MemCopy(buf, src, len);
buf[i] = *src++; buf[len] = 0;
buf[i] = 0; src += len;
switch (ch) switch (ch)
{ {
case 's': case 's':