summaryrefslogtreecommitdiff
path: root/libc/misc/gnu/obprintf.c
blob: 70c058fe5d17907d6063acf00e7e6e0b59a0b851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Copyright (C) 2013 Gentoo Foundation
 * Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
 */

#include <stdio.h>
#include <stdarg.h>

#ifdef _LIBC
# include <obstack.h>
#else
# include "obstack.h"
#endif

int
_obstack_vprintf (struct obstack *obstack, const char *format, va_list args)
{
  int n;
  char *s;
  n = vasprintf(&s, format, args);
  obstack_grow(obstack, s, n);
  return n;
}
weak_alias (_obstack_vprintf, obstack_vprintf)

int
_obstack_printf (struct obstack *obstack, const char *format, ...)
{
  int n;
  va_list ap;
  va_start (ap, format);
  n = _obstack_vprintf (obstack, format, ap);
  va_end (ap);
  return n;
}
weak_alias (_obstack_printf, obstack_printf)