summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/asprintf.c
Commit message (Collapse)AuthorAgeFilesLines
* Back out previous and solve the problems a different way: move va_start/tjr2002-09-261-20/+13
| | | | | | | | va_end closer to the __vfprintf() call, free the buffer when __vfprintf() fails and don't bother trying to shrink the buffer with realloc() before returning it. Submitted by: bde
* Sync with OpenBSD: avoid memory leak when __vfprintf() fails because ittjr2002-09-261-12/+20
| | | | runs out of memory, always call va_end.
* Leave room for a trailing NUL not a NULL, that's not an ASCII character.jmallett2002-08-191-1/+1
|
* Basic support for wide character I/O: getwc(), fgetwc(), getwchar(),tjr2002-08-131-0/+3
| | | | putwc(), fputwc(), putwchar(), ungetwc(), fwide().
* Assume __STDC__, remove non-__STDC__ code.alfred2002-05-281-15/+0
| | | | Submitted by: keramida
* Fix the style of the SCM ID's.obrien2002-03-221-3/+2
| | | | I believe have made all of libc .c's as consistent as possible.
* libc MT-safety, part 2.deischen2001-02-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a lock to FILE. flockfile and friends are now implemented (for the most part) in libc. flockfile_debug is implemented in libc_r; I suppose it's about time to kill it but will do it in a future commit. Fix a potential deadlock in _fwalk in a threaded environment. A file flag (__SIGN) was added to stdio.h that, when set, tells _fwalk to ignore it in its walk. This seemed to be needed in refill.c because each file needs to be locked when flushing. Add a stub for pthread_self in libc. This is needed by flockfile which is allowed by POSIX to be recursive. Make fgetpos() error return value (-1) match man page. Remove recursive calls to locked functions (stdio); I think I've got them all, but I may have missed a couple. A few K&R -> ANSI conversions along with removal of a few instances of "register". $Id$ -> $FreeBSD$ in libc/stdio/rget.c Not objected to: -arch, a few months ago
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Replace memory leaking instances of realloc with non-leaking reallocf.imp1998-09-161-2/+2
| | | | | | | | | | | In some cases replace if (a == null) a = malloc(x); else a = realloc(a, x); with simple reallocf(a, x). Per ANSI-C, this is guaranteed to be the same thing. I've been running these on my system here w/o ill effects for some time. However, the CTM-express is at part 6 of 34 for the CAM changes, so I've not been able to do a build world with the CAM in the tree with these changes. Shouldn't impact anything, but...
* Replace my original asprintf() and vasprintf() hacks with somethingpeter1998-07-081-18/+40
| | | | | | | | more cleanly integrated with stdio. This should be faster and cleaner since it doesn't memcpy() the data into a seperate buffer. This lets stdio allocate and manage the buffer and then hand it over to the user. Obtained from: Todd Miller <Todd.Miller@courtesan.com> via OpenBSD
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Add an implementation of the gnu-ish asprintf() and vasprintf(). They arepeter1996-05-271-0/+59
not based on gpl'ed code, just prototype and usage. I'm not 100% certain they behave the same while the system is in trouble (eg: malloc() failing) but in those circumstances all bets would be off anyway. These routines work like sprintf() and vsprintf(), except that instead of using a fixed buffer, they allocate memory and return it to the user and it's the user's responsibility to free() it. They have allocate as much memory as they need (and can get), so the size of strings it can deal with is limited only by the amount of memory it can malloc() on your behalf. There are a few gpl'ed programs starting to use this interface, and it's becoming more common with the scares about security risks with sprintf(). I dont like the look of the code that the various programs (including cvs, gdb, libg++, etc) provide if configure can't find it on the system. It should be possible to modify the stdio core code to provide this interface more efficiently, I was more worried about having something that worked and was secure. :-) (I noticed that there was once intended to be a smprintf() routine when our stdio was written for 4.4BSD, but it looks pretty stillborn, and it's intended interface is not clear). Since Linux and gnu libc have this interface, it seemed silly to bring yet another one onto the scene.
OpenPOWER on IntegriCloud