Skip to content

Commit 9c8b9a4

Browse files
committed
Refactored nxt_vsprintf().
1 parent c905d0d commit 9c8b9a4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/nxt_sprintf.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
156156
p = va_arg(args, const u_char *);
157157

158158
if (nxt_slow_path(p == NULL)) {
159-
goto copy;
159+
buf = nxt_cpymem(buf, null, nxt_length(null));
160+
continue;
160161
}
161162

162163
while (*p != '\0' && buf < end) {
@@ -174,6 +175,11 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
174175
fmt++;
175176
p = va_arg(args, const u_char *);
176177

178+
if (nxt_slow_path(p == NULL)) {
179+
buf = nxt_cpymem(buf, null, nxt_length(null));
180+
continue;
181+
}
182+
177183
goto copy;
178184
}
179185

@@ -556,14 +562,7 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
556562

557563
copy:
558564

559-
if (nxt_slow_path(p == NULL)) {
560-
p = null;
561-
length = nxt_length(null);
562-
563-
} else {
564-
length = nxt_min((size_t) (end - buf), length);
565-
}
566-
565+
length = nxt_min((size_t) (end - buf), length);
567566
buf = nxt_cpymem(buf, p, length);
568567
continue;
569568
}

0 commit comments

Comments
 (0)