Refactored nxt_vsprintf().
This commit is contained in:
@@ -156,7 +156,8 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
|
|||||||
p = va_arg(args, const u_char *);
|
p = va_arg(args, const u_char *);
|
||||||
|
|
||||||
if (nxt_slow_path(p == NULL)) {
|
if (nxt_slow_path(p == NULL)) {
|
||||||
goto copy;
|
buf = nxt_cpymem(buf, null, nxt_length(null));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*p != '\0' && buf < end) {
|
while (*p != '\0' && buf < end) {
|
||||||
@@ -174,6 +175,11 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
|
|||||||
fmt++;
|
fmt++;
|
||||||
p = va_arg(args, const u_char *);
|
p = va_arg(args, const u_char *);
|
||||||
|
|
||||||
|
if (nxt_slow_path(p == NULL)) {
|
||||||
|
buf = nxt_cpymem(buf, null, nxt_length(null));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
goto copy;
|
goto copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,14 +562,7 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
|
|||||||
|
|
||||||
copy:
|
copy:
|
||||||
|
|
||||||
if (nxt_slow_path(p == NULL)) {
|
|
||||||
p = null;
|
|
||||||
length = nxt_length(null);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
length = nxt_min((size_t) (end - buf), length);
|
length = nxt_min((size_t) (end - buf), length);
|
||||||
}
|
|
||||||
|
|
||||||
buf = nxt_cpymem(buf, p, length);
|
buf = nxt_cpymem(buf, p, length);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user