diff options
Diffstat (limited to 'src/msg.h')
-rw-r--r-- | src/msg.h | 43 |
1 files changed, 0 insertions, 43 deletions
@@ -29,47 +29,4 @@ void nv_info_msg(const char*, const char*, ...); void nv_msg(const char*, const char*, ...); void nv_msg_preserve_whitespace(const char*, const char*, ...); - -/* - * NV_VSNPRINTF(): macro that assigns buf using vsnprintf(). This is - * correct for differing semantics of vsnprintf() in different - * versions of glibc: - * - * different semantics of the return value from (v)snprintf: - * - * -1 when the buffer is not long enough (glibc < 2.1) - * - * or - * - * the length the string would have been if the buffer had been large - * enough (glibc >= 2.1) - * - * This macro allocates memory for buf; the caller should use free() - * when done. - */ -#define NV_FMT_BUF_LEN 256 -#define NV_VSNPRINTF(buf, fmt) \ -do { \ - va_list ap; \ - int len, current_len = NV_FMT_BUF_LEN; \ - \ - (buf) = malloc(current_len); \ - \ - while (1) { \ - va_start(ap, fmt); \ - len = vsnprintf((buf), current_len, (fmt), ap); \ - va_end(ap); \ - \ - if ((len > -1) && (len < current_len)) { \ - break; \ - } else if (len > -1) { \ - current_len = len + 1; \ - } else { \ - current_len += NV_FMT_BUF_LEN; \ - } \ - \ - (buf) = realloc(buf, current_len); \ - } \ -} while (0) - #endif /* __MSG_H__ */ |