diff options
author | Juliusz Chroboczek <jch@pps.jussieu.fr> | 2008-05-02 19:24:21 +0200 |
---|---|---|
committer | Juliusz Chroboczek <jch@pps.jussieu.fr> | 2008-05-02 19:24:21 +0200 |
commit | 4ecd697abe1026eb27e1373bf357ebca2ade4138 (patch) | |
tree | 75b68f89cf454ebfc129cb945dab70bc84c29698 | |
parent | 5cb6dcac85b89deea8263e1b7bcb7714e07063ff (diff) |
Use asprintf on GNU platforms.
This fixes fonttosfnt on AMD64 with glibc. It will still break on
non-GNU RISC platforms, because I'm incompetent and cannot use va_copy.
-rw-r--r-- | util.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -77,8 +77,22 @@ sprintf_reliable(char *f, ...) s = vsprintf_reliable(f, args); va_end(args); return s; -} +} +#ifdef __GLIBC__ +char* +vsprintf_reliable(char *f, va_list args) +{ + char *r; + int rc; + + rc = vasprintf(&r, f, args); + if(rc < 0) + return NULL; + return r; +} +#else +/* This is not portable, doesn't do va_copy right. */ char* vsprintf_reliable(char *f, va_list args) { @@ -101,6 +115,7 @@ vsprintf_reliable(char *f, va_list args) } /* NOTREACHED */ } +#endif /* Build a UTF-16 string from a Latin-1 string. Result is not NUL-terminated. */ |