diff options
author | peter <peter@FreeBSD.org> | 1997-05-15 22:46:24 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-05-15 22:46:24 +0000 |
commit | 4f40fe8334ad5f056e1d9105f23fe7ac859c39ba (patch) | |
tree | 3b2f0092fa216d9f61059ba94b7f10b5bacf9496 /contrib/cvs/lib/vasprintf.c | |
parent | 8982e501c77217c860f79bba431f46a62b607a21 (diff) | |
download | FreeBSD-src-4f40fe8334ad5f056e1d9105f23fe7ac859c39ba.zip FreeBSD-src-4f40fe8334ad5f056e1d9105f23fe7ac859c39ba.tar.gz |
Import of cvs-1.9.9-970515 onto vendor branch.
Obtained from: cyclic.com
Diffstat (limited to 'contrib/cvs/lib/vasprintf.c')
-rw-r--r-- | contrib/cvs/lib/vasprintf.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/contrib/cvs/lib/vasprintf.c b/contrib/cvs/lib/vasprintf.c index 45253b1..3dcfaaa 100644 --- a/contrib/cvs/lib/vasprintf.c +++ b/contrib/cvs/lib/vasprintf.c @@ -11,12 +11,7 @@ version 2 of the License, or (at your option) any later version. Libiberty 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 libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ +Library General Public License for more details. */ #include <stdio.h> #include <string.h> @@ -31,14 +26,17 @@ Cambridge, MA 02139, USA. */ #include <varargs.h> #endif -extern int abs (); - #ifdef TEST int global_total_width; #endif -unsigned long strtoul (); -char *malloc (); +#ifdef STDC_HEADERS +#include <stdlib.h> +#else +extern int abs (); +extern unsigned long strtoul (); +extern char *malloc (); +#endif static int int_vasprintf (result, format, args) @@ -66,7 +64,7 @@ int_vasprintf (result, format, args) total_width += abs (va_arg (ap, int)); } else - total_width += strtoul (p, &p, 10); + total_width += strtoul (p, (char **)&p, 10); if (*p == '.') { ++p; @@ -76,7 +74,7 @@ int_vasprintf (result, format, args) total_width += abs (va_arg (ap, int)); } else - total_width += strtoul (p, &p, 10); + total_width += strtoul (p, (char **)&p, 10); } while (strchr ("hlL", *p)) ++p; @@ -126,7 +124,13 @@ vasprintf (result, format, args) const char *format; va_list args; { +#ifdef VA_LIST_IS_ARRAY + /* If va_list is an array, we do not need the additional indirection */ + return int_vasprintf (result, format, args); +#else + /* va_list is some sort of pointer */ return int_vasprintf (result, format, &args); +#endif } #ifdef TEST |