> 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:45:08 up 2 days,  1:59,  1 user,  load average: 1.05, 0.55, 0.42
This commit is contained in:
tracer-ics2023
2024-09-14 11:45:08 +08:00
committed by zzy
parent 0ba097af28
commit d528ebfe96
2 changed files with 8 additions and 8 deletions

View File

@ -27,15 +27,15 @@ int num_to_ascii(int num, int power, int size, char *buf) {
return ret;
}
static inline int print_fmt(char **out, int n, const char** fmt, va_list* ap) {
static inline int print_fmt(char **out, int n, const char** fmt, va_list ap) {
int ret = 0;
switch (**fmt) {
case 'd':
ret = num_to_ascii(va_arg(*ap, int), 10, n, *out);
ret = num_to_ascii(va_arg(ap, int), 10, n, *out);
(*out) += ret;
break;
case 's':
const char* str = va_arg(*ap, const char*);
const char* str = va_arg(ap, const char*);
if (ret > n) break;
for (; *str; str ++, (*out) ++, ret ++ ) {
if (ret >= n) {
@ -45,13 +45,13 @@ static inline int print_fmt(char **out, int n, const char** fmt, va_list* ap) {
}
break;
case 'c':
char ch = va_arg(*ap, int);
char ch = va_arg(ap, int);
ret = 1;
**out = ch;
(*out) ++;
break;
case 'x':
ret = num_to_ascii(va_arg(*ap, int), 16, n, *out);
ret = num_to_ascii(va_arg(ap, int), 16, n, *out);
(*out) += ret;
break;
default:
@ -61,7 +61,7 @@ static inline int print_fmt(char **out, int n, const char** fmt, va_list* ap) {
return ret;
}
int rvsnprintf(char* out, size_t n, const char* fmt, va_list* ap) {
int rvsnprintf(char* out, size_t n, const char* fmt, va_list ap) {
int ret = 0;
while(*fmt && n) {
if (*fmt == '%') {

View File

@ -34,10 +34,10 @@ int snprintf(char *out, size_t n, const char *fmt, ...) {
return ret;
}
int rvsnprintf(char* out, size_t n, const char* fmt, va_list* ap);
int rvsnprintf(char* out, size_t n, const char* fmt, va_list ap);
int vsnprintf(char *out, size_t n, const char *fmt, va_list ap) {
return rvsnprintf(out, n, fmt, &ap);
return rvsnprintf(out, n, fmt, ap);
}
#endif