Add ssizeof macro that returns ssize_t.
We can use this instead of casting the result of size_t to int. Also change checks for snprintf() returning <=0 to <0.
This commit is contained in:
@@ -208,7 +208,7 @@ warning(const char *errstr, const char *fmt, va_list ap)
|
||||
va_copy(ap2, ap);
|
||||
buflen = vsnprintf(static_buf, sizeof(static_buf), fmt, ap2);
|
||||
va_end(ap2);
|
||||
if (buflen >= (int)sizeof(static_buf)) {
|
||||
if (buflen >= ssizeof(static_buf)) {
|
||||
buf = malloc(++buflen);
|
||||
if (buf != NULL)
|
||||
(void)vsnprintf(buf, buflen, fmt, ap);
|
||||
|
Reference in New Issue
Block a user