> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 11:02:49 up  1:42,  1 user,  load average: 0.11, 0.22, 0.22
This commit is contained in:
tracer-ics2023
2024-09-11 11:02:50 +08:00
committed by zzy
parent 988e7750c2
commit fa065329cf

View File

@ -96,24 +96,27 @@ static int rvsnprintf(char* out, size_t n, const char* fmt, va_list ap) {
char* _out = out;
size_t _n = n;
const char* _fmt = fmt;
bool end = false;
while (n && !end) {
while (_n) {
switch (*_fmt) {
case '\0':
*_out = *_fmt;
end = true;
_n = 0;
break;
case '%':
_fmt ++;
int len = fmt_match(_out, _n, _fmt, ap);
_out += len - 1;
_n -= len + 1;
_out += len;
_n -= len;
_fmt += 2;
break;
default:
*_out = *_fmt;
_out ++;
_fmt ++;
_n ++;
break;
}
}
assert(*out == '\0');
assert(*_out == '\0');
return 1;
}