From b85c7de2f7721e3951ceb68154701fbdb7c4fab5 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 29 Aug 2011 19:59:36 +1000 Subject: [PATCH] use vsnprintf() on all platforms, dont special case win32 for vsnprintf and all other platforms use vasprintf --- lib/init.c | 10 ++-------- lib/libnfs.c | 6 +----- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/init.c b/lib/init.c index d9f788f..d421797 100644 --- a/lib/init.c +++ b/lib/init.c @@ -90,19 +90,13 @@ void rpc_set_auth(struct rpc_context *rpc, struct AUTH *auth) void rpc_set_error(struct rpc_context *rpc, char *error_string, ...) { va_list ap; - char *str; if (rpc->error_string != NULL) { free(rpc->error_string); } va_start(ap, error_string); -#if defined (WIN32) - str = malloc(1024); - vsnprintf(str, 1024, error_string, ap); -#else - vasprintf(&str, error_string, ap); -#endif - rpc->error_string = str; + rpc->error_string = malloc(1024); + vsnprintf(rpc->error_string, 1024, error_string, ap); va_end(ap); } diff --git a/lib/libnfs.c b/lib/libnfs.c index df273fb..df8ae80 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -2899,16 +2899,12 @@ void nfs_set_error(struct nfs_context *nfs, char *error_string, ...) char *str = NULL; va_start(ap, error_string); -#if defined (WIN32) str = malloc(1024); vsnprintf(str, 1024, error_string, ap); -#else - vasprintf(&str, error_string, ap); -#endif if (nfs->rpc->error_string != NULL) { free(nfs->rpc->error_string); } - fs->rpc->error_string = str; + nfs->rpc->error_string = str; va_end(ap); } -- 2.34.1