Changeset 609 for branches/GNU/src/binutils/libiberty/asprintf.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/libiberty/asprintf.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 23 23 #include "libiberty.h" 24 24 25 #if defined (ANSI_PROTOTYPES) || defined (ALMOST_STDC) 26 #define USE_STDARG 27 #endif 28 29 #ifdef USE_STDARG 25 #ifdef ANSI_PROTOTYPES 30 26 #include <stdarg.h> 31 27 #else … … 33 29 #endif 34 30 35 /* VARARGS */ 36 #ifdef USE_STDARG 31 /* 32 33 @deftypefn Extension int asprintf (char **@var{resptr}, const char *@var{format}, ...) 34 35 Like @code{sprintf}, but instead of passing a pointer to a buffer, you 36 pass a pointer to a pointer. This function will compute the size of 37 the buffer needed, allocate memory with @code{malloc}, and store a 38 pointer to the allocated memory in @code{*@var{resptr}}. The value 39 returned is the same as @code{sprintf} would return. If memory could 40 not be allocated, zero is returned and @code{NULL} is stored in 41 @code{*@var{resptr}}. 42 43 @end deftypefn 44 45 */ 46 37 47 int 38 asprintf (char **buf, const char *fmt, ...) 39 #else 40 int 41 asprintf (buf, fmt, va_alist) 42 char **buf; 43 const char *fmt; 44 va_dcl 45 #endif 48 asprintf VPARAMS ((char **buf, const char *fmt, ...)) 46 49 { 47 50 int status; 48 va_list ap; 49 #ifdef USE_STDARG 50 va_start (ap, fmt); 51 #else 52 va_start (ap); 53 #endif 51 VA_OPEN (ap, fmt); 52 VA_FIXEDARG (ap, char **, buf); 53 VA_FIXEDARG (ap, const char *, fmt); 54 54 status = vasprintf (buf, fmt, ap); 55 va_end(ap);55 VA_CLOSE (ap); 56 56 return status; 57 57 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.