1 /* __gmp_sprintf_funs -- support for gmp_sprintf and gmp_vsprintf.
3 THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
4 CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
5 FUTURE GNU MP RELEASES.
7 Copyright 2001 Free Software Foundation, Inc.
9 This file is part of the GNU MP Library.
11 The GNU MP Library is free software; you can redistribute it and/or modify
12 it under the terms of either:
14 * the GNU Lesser General Public License as published by the Free
15 Software Foundation; either version 3 of the License, or (at your
16 option) any later version.
20 * the GNU General Public License as published by the Free Software
21 Foundation; either version 2 of the License, or (at your option) any
24 or both in parallel, as here.
26 The GNU MP Library is distributed in the hope that it will be useful, but
27 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
28 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
31 You should have received copies of the GNU General Public License and the
32 GNU Lesser General Public License along with the GNU MP Library. If not,
33 see https://www.gnu.org/licenses/. */
44 /* The data parameter "bufp" points to a "char *buf" which is the next
45 character to be written, having started as the destination from the
46 application. This is then increased each time output is produced. */
49 /* If vsprintf returns -1 then pass it upwards. It doesn't matter that
50 "*bufp" is ruined in this case, since gmp_doprint will bail out
51 immediately anyway. */
53 gmp_sprintf_format (char **bufp, const char *fmt, va_list ap)
57 vsprintf (buf, fmt, ap);
64 gmp_sprintf_memory (char **bufp, const char *str, size_t len)
68 memcpy (buf, str, len);
73 gmp_sprintf_reps (char **bufp, int c, int reps)
78 memset (buf, c, reps);
83 gmp_sprintf_final (char **bufp, int c, int reps)
90 const struct doprnt_funs_t __gmp_sprintf_funs = {
91 (doprnt_format_t) gmp_sprintf_format,
92 (doprnt_memory_t) gmp_sprintf_memory,
93 (doprnt_reps_t) gmp_sprintf_reps,
94 (doprnt_final_t) gmp_sprintf_final