Initial revision
[libfirm] / ir / common / xoprintf.c
1 /* Xfprintf --- extended formatted output to obstacks.
2    Copyright (C) 1995, 1996 Christian von Roques */
3
4 #ifdef HAVE_CONFIG_H
5 # include <config.h>
6 #endif
7
8 #ifndef USE_PRINTF
9
10 #include <obstack.h>
11 #include <string.h>
12 #include <assert.h>
13 #include "xprintf.h"
14
15
16 static int
17 xoprinter (void *obst, const char *data, size_t len)
18 {
19   obstack_grow ((struct obstack *)obst, data, len);
20   return len;
21 }
22
23
24 int
25 xoprintf (struct obstack *obst, const char *fmt, ...)
26 {
27   va_list args;
28   int res;
29
30   va_start (args, fmt);
31   res = xvgprintf (xoprinter, obst, fmt, args);
32   va_end (args);
33   return res;
34 }
35
36
37 int
38 xvoprintf (struct obstack *obst, const char *fmt, va_list args)
39 {
40   return xvgprintf (xoprinter, obst, fmt, args);
41 }
42
43 #endif /* USE_PRINTF */