Call va_end soon after using variable length variable

- This fix MSVC compiler warning C4702 "unreachable code".
This commit is contained in:
kinichiro 2018-01-06 00:28:49 +09:00
parent 52c39d42ea
commit 1f4bfb9a4d

View File

@ -34,9 +34,9 @@ err(int eval, const char *fmt, ...)
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
va_end(ap);
fprintf(stderr, "%s\n", strerror(sverrno));
exit(eval);
va_end(ap);
}
#if defined(_MSC_VER)
@ -52,9 +52,9 @@ errx(int eval, const char *fmt, ...)
va_start(ap, fmt);
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
exit(eval);
va_end(ap);
}
static inline void
@ -68,8 +68,8 @@ warn(const char *fmt, ...)
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
fprintf(stderr, "%s\n", strerror(sverrno));
va_end(ap);
fprintf(stderr, "%s\n", strerror(sverrno));
}
static inline void
@ -80,8 +80,8 @@ warnx(const char *fmt, ...)
va_start(ap, fmt);
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
fprintf(stderr, "\n");
}
#endif