diff options
author | Sam Roberts <sroberts@uniserve.com> | 2002-04-16 02:26:22 +0000 |
---|---|---|
committer | Sam Roberts <sroberts@uniserve.com> | 2002-04-16 02:26:22 +0000 |
commit | acc5a383d5d9dc8f94eb88dd052b9996958d17b2 (patch) | |
tree | 967169f297f8f75c476b6a91a3d0522e04059c07 /lib | |
parent | 8f380c039eccd4837726a8e96c47fd55f9ea095f (diff) | |
download | mailutils-acc5a383d5d9dc8f94eb88dd052b9996958d17b2.tar.gz mailutils-acc5a383d5d9dc8f94eb88dd052b9996958d17b2.tar.bz2 |
One way to get rid of the annoying warnings about asprintf() not being
declared is to always call a mailutils wrapper function, which in turn
calls the real function. That means the wrappers (and other functions in
lib) will still compile with warnings, but the mailbox and utility code
can compile clean.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 4 | ||||
-rw-r--r-- | lib/mu_asprintf.c | 36 | ||||
-rw-r--r-- | lib/mu_asprintf.h | 29 |
3 files changed, 67 insertions, 2 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 642774245..0dd568ff6 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -6,7 +6,7 @@ SUBDIRS = posix INCLUDES = -I${top_srcdir}/include libmailutils_la_SOURCES = basename.c daemon.c getopt.c getopt1.c md5.c \ mu_dbm.c getline.c xstrdup.c xmalloc.c argcv.c \ - mu_argp.c pin.c + mu_argp.c pin.c mu_asprintf.c EXTRA_DIST = alloca.c fnmatch.c fgetpwent.c getpass.c malloc.c obstack.c \ realloc.c setenv.c snprintf.c strchrnul.c strndup.c strnlen.c strncasecmp.c \ @@ -16,7 +16,7 @@ EXTRA_DIST = alloca.c fnmatch.c fgetpwent.c getpass.c malloc.c obstack.c \ noinst_HEADERS = argcv.h error.h fnmatch.h getline.h getopt.h md5.h mu_dbm.h\ regex.h snprintf.h xalloc.h xstrtol.h obstack.h mu_argp.h \ - argp-fmtstream.h argp-namefrob.h argp.h + argp-fmtstream.h argp-namefrob.h argp.h mu_asprintf.h libmailutils_la_LIBADD = @LTLIBOBJS@ @LTALLOCA@ diff --git a/lib/mu_asprintf.c b/lib/mu_asprintf.c new file mode 100644 index 000000000..5704012a1 --- /dev/null +++ b/lib/mu_asprintf.c @@ -0,0 +1,36 @@ +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "mu_asprintf.h" + +int +mu_vasprintf (char **result, const char *format, va_list * args) +{ + return vasprintf (result, format, args); +} + +extern int +mu_asprintf (char **result, const char *format, ...) +{ + va_list args; + int done; + + va_start (args, format); + done = vasprintf (result, format, args); + va_end (args); + + return done; +} diff --git a/lib/mu_asprintf.h b/lib/mu_asprintf.h new file mode 100644 index 000000000..6cbcabd20 --- /dev/null +++ b/lib/mu_asprintf.h @@ -0,0 +1,29 @@ +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef MUASPRINTF_H +#define MUASPRINTF_H + +#include <mailutils/mu_features.h> + +#include <stdarg.h> + +extern int mu_vasprintf __P ((char **result, const char *format, va_list * args)); + +extern int mu_asprintf __P ((char **result, const char *format, ...)); + +#endif + |