Add aswprintf

The format string won't get checked but I'm not sure I can reasonably
use the same hack.
weechat-hashes
Curtis McEnroe 2018-09-02 01:03:12 -04:00
parent 140f6e896d
commit e5663d45df
No known key found for this signature in database
GPG Key ID: CEA2F97ADCFCD77C
2 changed files with 9 additions and 0 deletions

1
chat.h
View File

@ -169,6 +169,7 @@ wchar_t *ambstowcs(const char *src);
char *awcstombs(const wchar_t *src);
char *awcsntombs(const wchar_t *src, size_t nwc);
int vaswprintf(wchar_t **ret, const wchar_t *format, va_list ap);
int aswprintf(wchar_t **ret, const wchar_t *format, ...);
// HACK: clang won't check wchar_t *format strings.
#ifdef NDEBUG

8
pls.c
View File

@ -120,3 +120,11 @@ fail:
*ret = NULL;
return -1;
}
int aswprintf(wchar_t **ret, const wchar_t *format, ...) {
va_list ap;
va_start(ap, format);
int n = vaswprintf(ret, format, ap);
va_end(ap);
return n;
}