dhcpcd: update README.DRAGONFLY
[dragonfly.git] / contrib / gmp / printf / obprntffuns.c
blob092e6cca21ba6887a7c3963648192f187be25240
1 /* __gmp_obstack_printf_funs -- support for gmp_obstack_printf and
2 gmp_obstack_vprintf.
4 THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
5 CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
6 FUTURE GNU MP RELEASES.
8 Copyright 2001 Free Software Foundation, Inc.
10 This file is part of the GNU MP Library.
12 The GNU MP Library is free software; you can redistribute it and/or modify
13 it under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or (at your
15 option) any later version.
17 The GNU MP Library is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20 License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
25 #include "config.h"
27 #if HAVE_OBSTACK_VPRINTF
29 #define _GNU_SOURCE /* ask glibc <stdio.h> for obstack_vprintf */
31 #if HAVE_STDARG
32 #include <stdarg.h>
33 #else
34 #include <varargs.h>
35 #endif
37 #include <stdio.h> /* for obstack_vprintf */
38 #include <string.h>
39 #include <obstack.h>
41 #include "gmp.h"
42 #include "gmp-impl.h"
45 static int
46 gmp_obstack_memory (struct obstack *ob, const char *ptr, size_t len)
48 obstack_grow (ob, ptr, len);
49 return len;
52 static int
53 gmp_obstack_reps (struct obstack *ob, int c, int reps)
55 obstack_blank (ob, reps);
56 memset ((char *) obstack_next_free(ob) - reps, c, reps);
57 return reps;
60 const struct doprnt_funs_t __gmp_obstack_printf_funs = {
61 (doprnt_format_t) obstack_vprintf,
62 (doprnt_memory_t) gmp_obstack_memory,
63 (doprnt_reps_t) gmp_obstack_reps
66 #endif /* HAVE_OBSTACK_VPRINTF */