Mercurial > hg > CbC > CbC_gcc
comparison libiberty/asprintf.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | a06113de4d67 |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* Like sprintf but provides a pointer to malloc'd storage, which must | 1 /* Like sprintf but provides a pointer to malloc'd storage, which must |
2 be freed by the caller. | 2 be freed by the caller. |
3 Copyright (C) 1997, 2003 Free Software Foundation, Inc. | 3 Copyright (C) 1997-2017 Free Software Foundation, Inc. |
4 Contributed by Cygnus Solutions. | 4 Contributed by Cygnus Solutions. |
5 | 5 |
6 This file is part of the libiberty library. | 6 This file is part of the libiberty library. |
7 Libiberty is free software; you can redistribute it and/or | 7 Libiberty is free software; you can redistribute it and/or |
8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
45 | 45 |
46 int | 46 int |
47 asprintf (char **buf, const char *fmt, ...) | 47 asprintf (char **buf, const char *fmt, ...) |
48 { | 48 { |
49 int status; | 49 int status; |
50 VA_OPEN (ap, fmt); | 50 va_list ap; |
51 VA_FIXEDARG (ap, char **, buf); | 51 va_start (ap, fmt); |
52 VA_FIXEDARG (ap, const char *, fmt); | |
53 status = vasprintf (buf, fmt, ap); | 52 status = vasprintf (buf, fmt, ap); |
54 VA_CLOSE (ap); | 53 va_end (ap); |
55 return status; | 54 return status; |
56 } | 55 } |