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.
Showing
4 changed files
with
68 additions
and
3 deletions
... | @@ -6,7 +6,7 @@ SUBDIRS = posix | ... | @@ -6,7 +6,7 @@ SUBDIRS = posix |
6 | INCLUDES = -I${top_srcdir}/include | 6 | INCLUDES = -I${top_srcdir}/include |
7 | libmailutils_la_SOURCES = basename.c daemon.c getopt.c getopt1.c md5.c \ | 7 | libmailutils_la_SOURCES = basename.c daemon.c getopt.c getopt1.c md5.c \ |
8 | mu_dbm.c getline.c xstrdup.c xmalloc.c argcv.c \ | 8 | mu_dbm.c getline.c xstrdup.c xmalloc.c argcv.c \ |
9 | mu_argp.c pin.c | 9 | mu_argp.c pin.c mu_asprintf.c |
10 | 10 | ||
11 | EXTRA_DIST = alloca.c fnmatch.c fgetpwent.c getpass.c malloc.c obstack.c \ | 11 | EXTRA_DIST = alloca.c fnmatch.c fgetpwent.c getpass.c malloc.c obstack.c \ |
12 | realloc.c setenv.c snprintf.c strchrnul.c strndup.c strnlen.c strncasecmp.c \ | 12 | 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 \ | ... | @@ -16,7 +16,7 @@ EXTRA_DIST = alloca.c fnmatch.c fgetpwent.c getpass.c malloc.c obstack.c \ |
16 | 16 | ||
17 | noinst_HEADERS = argcv.h error.h fnmatch.h getline.h getopt.h md5.h mu_dbm.h\ | 17 | noinst_HEADERS = argcv.h error.h fnmatch.h getline.h getopt.h md5.h mu_dbm.h\ |
18 | regex.h snprintf.h xalloc.h xstrtol.h obstack.h mu_argp.h \ | 18 | regex.h snprintf.h xalloc.h xstrtol.h obstack.h mu_argp.h \ |
19 | argp-fmtstream.h argp-namefrob.h argp.h | 19 | argp-fmtstream.h argp-namefrob.h argp.h mu_asprintf.h |
20 | 20 | ||
21 | libmailutils_la_LIBADD = @LTLIBOBJS@ @LTALLOCA@ | 21 | libmailutils_la_LIBADD = @LTLIBOBJS@ @LTALLOCA@ |
22 | 22 | ... | ... |
lib/mu_asprintf.c
0 → 100644
1 | /* | ||
2 | This program is free software; you can redistribute it and/or modify | ||
3 | it under the terms of the GNU Library General Public License as published by | ||
4 | the Free Software Foundation; either version 2 of the License, or | ||
5 | (at your option) any later version. | ||
6 | |||
7 | This program is distributed in the hope that it will be useful, | ||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | GNU Library General Public License for more details. | ||
11 | |||
12 | You should have received a copy of the GNU Library General Public License | ||
13 | along with this program; if not, write to the Free Software | ||
14 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
15 | */ | ||
16 | |||
17 | #include "mu_asprintf.h" | ||
18 | |||
19 | int | ||
20 | mu_vasprintf (char **result, const char *format, va_list * args) | ||
21 | { | ||
22 | return vasprintf (result, format, args); | ||
23 | } | ||
24 | |||
25 | extern int | ||
26 | mu_asprintf (char **result, const char *format, ...) | ||
27 | { | ||
28 | va_list args; | ||
29 | int done; | ||
30 | |||
31 | va_start (args, format); | ||
32 | done = vasprintf (result, format, args); | ||
33 | va_end (args); | ||
34 | |||
35 | return done; | ||
36 | } |
lib/mu_asprintf.h
0 → 100644
1 | /* | ||
2 | This program is free software; you can redistribute it and/or modify | ||
3 | it under the terms of the GNU Library General Public License as published by | ||
4 | the Free Software Foundation; either version 2 of the License, or | ||
5 | (at your option) any later version. | ||
6 | |||
7 | This program is distributed in the hope that it will be useful, | ||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | GNU Library General Public License for more details. | ||
11 | |||
12 | You should have received a copy of the GNU Library General Public License | ||
13 | along with this program; if not, write to the Free Software | ||
14 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
15 | */ | ||
16 | |||
17 | #ifndef MUASPRINTF_H | ||
18 | #define MUASPRINTF_H | ||
19 | |||
20 | #include <mailutils/mu_features.h> | ||
21 | |||
22 | #include <stdarg.h> | ||
23 | |||
24 | extern int mu_vasprintf __P ((char **result, const char *format, va_list * args)); | ||
25 | |||
26 | extern int mu_asprintf __P ((char **result, const char *format, ...)); | ||
27 | |||
28 | #endif | ||
29 |
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | 2 | ||
3 | AUTOMAKE_OPTIONS = ../lib/ansi2knr | 3 | AUTOMAKE_OPTIONS = ../lib/ansi2knr |
4 | 4 | ||
5 | INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox/include | 5 | INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox/include -I${top_srcdir}/lib |
6 | AM_CFLAGS = -DSITE_VIRTUAL_PWDDIR=\"@SITE_VIRTUAL_PWDDIR@\" | 6 | AM_CFLAGS = -DSITE_VIRTUAL_PWDDIR=\"@SITE_VIRTUAL_PWDDIR@\" |
7 | 7 | ||
8 | SUBDIRS = include | 8 | SUBDIRS = include | ... | ... |
-
Please register or sign in to post a comment