1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 2003 Matthias Clasen
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GLib Team and others 2003. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
33 #include "gst-printf.h"
34 #include "vasnprintf.h"
39 __gst_printf (char const *format, ...)
44 va_start (args, format);
45 retval = __gst_vprintf (format, args);
52 __gst_fprintf (FILE * file, char const *format, ...)
57 va_start (args, format);
58 retval = __gst_vfprintf (file, format, args);
65 __gst_sprintf (char *string, char const *format, ...)
70 va_start (args, format);
71 retval = __gst_vsprintf (string, format, args);
78 __gst_snprintf (char *string, size_t n, char const *format, ...)
83 va_start (args, format);
84 retval = __gst_vsnprintf (string, n, format, args);
91 __gst_vprintf (char const *format, va_list args)
93 return __gst_vfprintf (stdout, format, args);
97 __gst_vfprintf (FILE * file, char const *format, va_list args)
102 result = vasnprintf (NULL, &length, format, args);
106 fwrite (result, 1, length, file);
113 __gst_vsprintf (char *string, char const *format, va_list args)
118 result = vasnprintf (NULL, &length, format, args);
122 memcpy (string, result, length + 1);
129 __gst_vsnprintf (char *string, size_t n, char const *format, va_list args)
134 result = vasnprintf (NULL, &length, format, args);
139 memcpy (string, result, MIN (length + 1, n));
150 __gst_vasprintf (char **result, char const *format, va_list args)
154 *result = vasnprintf (NULL, &length, format, args);