diff options
author | marha <marha@users.sourceforge.net> | 2012-03-23 10:05:55 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-23 10:05:55 +0100 |
commit | 0f834b91a4768673833ab4917e87d86c237bb1a6 (patch) | |
tree | 363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/os/xprintf.c | |
parent | fc72edebf875378459368c5383d9023730cbca54 (diff) | |
download | vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2 vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip |
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/os/xprintf.c')
-rw-r--r-- | xorg-server/os/xprintf.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/xorg-server/os/xprintf.c b/xorg-server/os/xprintf.c index 3b4bb4117..17fea2ec7 100644 --- a/xorg-server/os/xprintf.c +++ b/xorg-server/os/xprintf.c @@ -68,18 +68,18 @@ #include <string.h> #ifdef asprintf -# undef asprintf +#undef asprintf #endif #ifdef vasprintf -# undef vasprintf +#undef vasprintf #endif #ifndef va_copy -# ifdef __va_copy -# define va_copy __va_copy -# else -# error "no working va_copy was found" -# endif +#ifdef __va_copy +#define va_copy __va_copy +#else +#error "no working va_copy was found" +#endif #endif /** @@ -93,7 +93,7 @@ * @return size of allocated buffer, or -1 on error. */ int -Xvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va) +Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va) { #ifdef HAVE_VASPRINTF return vasprintf(ret, format, va); @@ -116,7 +116,7 @@ Xvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va) } #ifndef HAVE_VASPRINTF -# define vasprintf Xvasprintf +#define vasprintf Xvasprintf #endif /** @@ -130,10 +130,11 @@ Xvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va) * @return size of allocated buffer, or -1 on error. */ int -Xasprintf(char ** ret, const char * _X_RESTRICT_KYWD format, ...) +Xasprintf(char **ret, const char *_X_RESTRICT_KYWD format, ...) { int size; va_list va; + va_start(va, format); size = vasprintf(ret, format, va); va_end(va); @@ -152,11 +153,12 @@ Xasprintf(char ** ret, const char * _X_RESTRICT_KYWD format, ...) * @return size of allocated buffer */ int -XNFvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va) +XNFvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va) { int size = vasprintf(ret, format, va); + if ((size == -1) || (*ret == NULL)) { - FatalError("XNFvasprintf failed: %s", strerror(errno)); + FatalError("XNFvasprintf failed: %s", strerror(errno)); } return size; } @@ -173,10 +175,11 @@ XNFvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va) * @return size of allocated buffer */ int -XNFasprintf(char ** ret, const char * _X_RESTRICT_KYWD format, ...) +XNFasprintf(char **ret, const char *_X_RESTRICT_KYWD format, ...) { int size; va_list va; + va_start(va, format); size = XNFvasprintf(ret, format, va); va_end(va); @@ -190,18 +193,20 @@ Xvprintf(const char *format, va_list va) char *ret; if (vasprintf(&ret, format, va) == -1) - ret = NULL; + ret = NULL; return ret; } -char *Xprintf(const char *format, ...) +char * +Xprintf(const char *format, ...) { char *ret; va_list va; + va_start(va, format); if (vasprintf(&ret, format, va) == -1) - ret = NULL; + ret = NULL; va_end(va); return ret; } @@ -216,10 +221,12 @@ XNFvprintf(const char *format, va_list va) return ret; } -char *XNFprintf(const char *format, ...) +char * +XNFprintf(const char *format, ...) { char *ret; va_list va; + va_start(va, format); XNFvasprintf(&ret, format, va); va_end(va); |