History log of /openbsd-current/lib/libc/stdio/vasprintf.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.23 25-Jan-2019 millert

I am retiring my old email address; replace it with my OpenBSD one.


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.22 17-Mar-2017 deraadt

Use recallocarray() to avoid leaving detritus in memory when resizing
buffers. We don't bother doing this for objects containing pointers,
but focus on controllable data.
ok millert


# 1.21 16-Mar-2017 millert

Only reallocate the buffer to fit for medium-size allocations where
we expanded the buffer to a single page. The final realloc() can
be expensive for large buffers and is not realled needed. OK deraadt@


# 1.20 14-Mar-2017 millert

Use a macro for the initial length of the buffer instead of 127; OK deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.19 28-Dec-2015 mmcc

Remove NULL-checks before free() and a few related dead assignments.

ok and valuable input from millert@


# 1.18 31-Aug-2015 guenther

Add framework for resolving (pun intended) libc namespace issues, using
wrapper .h files and asm labels to let internal calls resolve directly and
not be overridable or use the PLT. Then, apply that framework to most of
the functions in stdio.h, string.h, err.h, and wchar.h. Delete the
should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here.

tests clean on i386, amd64, sparc64, powerpc, and mips64

naming feedback from kettenis@ and millert@
ok kettenis@


# 1.17 20-Aug-2015 deraadt

All these files include <stdlib.h>, so do not need to cast
malloc/calloc/realloc* returns.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 09-Nov-2009 kurt

Fix the handle locking in stdio to use flockfile/funlockfile
internally when and where required. Macros in <stdio.h> are updated
to automatically call the underlying functions when the process is
threaded to obtain the necessary locking. A private mutex is added
to protect __sglue, the internal list of FILE handles, and another
to protect the one-time initialization. Some routines in libc that
use getc() change to use getc_unlocked() as they're either protected
by their own lock or aren't thread-safe routines anyway.

committing on behalf of and okay guenther@ now that we have install
media space available.


# 1.15 22-Oct-2009 guenther

Back out previous commit, as it caused too much growth for the install
media to fit


# 1.14 21-Oct-2009 guenther

Fix the handle locking in stdio to use flockfile/funlockfile
internally when and where required. Macros in <stdio.h> are updated
to automatically call the underlying functions when the process is
threaded to obtain the necessary locking. A private mutex is added
to protect __sglue, the internal list of FILE handles, and another
to protect the one-time initialization. Some routines in libc that
use getc() change to use getc_unlocked() as they're either protected
by their own lock or aren't thread-safe routines anyway.

ok kurt@, earlier version tested by sthen@ and jj@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.13 06-Jan-2006 millert

Adapt things to use __type_t instead of _BSD_TYPE_T_
Add new sys/_types.h header
Include machine/_types.h or sys/_types.h where applicable


# 1.12 10-Oct-2005 espie

Remove a few warnings. Those were not apparent thanks to a bug in gcc 2.95.

Patch by Leonardo Chiquitto Filho <leonardo@iken.com.br>
Thanks.


Revision tags: OPENBSD_3_8_BASE
# 1.11 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.10 30-Apr-2005 espie

Change internals of FILE: reuse the unget buffer field to access an
extended attribute data structure (pimpl idiom). Idea taken from citrus.
Much discussion with deraadt@, otto@, millert@...

This is the least disruptive way to extend FILE, since its size can't really
change without this being a flag day. So the size doesn't change.

Actual additions to the structure will come in separate steps, since this
change is nasty enough on its own.

Tests by otto@ and others, careful reading of code by otto@ and millert@.

This is definitely a major bump, and has been checked to not impact a
full ports build.


Revision tags: OPENBSD_3_7_BASE
# 1.9 28-Sep-2004 otto

deregister + ansify, no change in object code. ok deraadt@ millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.8 17-Jun-2003 millert

Sync with share/misc/license.template and add missing DARPA credit
where applicable.


# 1.7 03-Jun-2003 millert

Use an ISC-tyle license for all my code; it is simpler and more permissive.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.6 16-Oct-1998 millert

Make sure we free the buffer in all error cases. Do the final
realloc(3) to the size of the string, not the size of the buffer
allocated for the string (which is a noop). mycroft@netbsd.org


# 1.5 14-Aug-1998 deraadt

realloc repair


# 1.4 21-Jun-1998 millert

Remove the advertising clause in my old license, it impedes free use
of the code as a large number of similar clauses makes it impossible
to write an ad for a product using the code...


Revision tags: OPENBSD_2_3_BASE
# 1.3 07-Feb-1998 tholo

Cast pointer in assignment


# 1.2 12-Jan-1998 millert

Based on some FreeBSD changes:
For *s*printf, set f._file to -1 like the comments in stdio.h say.
Use '\0', not 0, where appropriate.
Don't error out on size of '0' for v?snprintf().


# 1.1 29-Nov-1997 millert

Implement asprintf(3) and vasprintf(3) functions similar to the
ones in the glibc. Some man pages changes from FreeBSD
(asprintf.c/vasprintf.c are not based on GNU or FreeBSD code).


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.22 17-Mar-2017 deraadt

Use recallocarray() to avoid leaving detritus in memory when resizing
buffers. We don't bother doing this for objects containing pointers,
but focus on controllable data.
ok millert


# 1.21 16-Mar-2017 millert

Only reallocate the buffer to fit for medium-size allocations where
we expanded the buffer to a single page. The final realloc() can
be expensive for large buffers and is not realled needed. OK deraadt@


# 1.20 14-Mar-2017 millert

Use a macro for the initial length of the buffer instead of 127; OK deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.19 28-Dec-2015 mmcc

Remove NULL-checks before free() and a few related dead assignments.

ok and valuable input from millert@


# 1.18 31-Aug-2015 guenther

Add framework for resolving (pun intended) libc namespace issues, using
wrapper .h files and asm labels to let internal calls resolve directly and
not be overridable or use the PLT. Then, apply that framework to most of
the functions in stdio.h, string.h, err.h, and wchar.h. Delete the
should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here.

tests clean on i386, amd64, sparc64, powerpc, and mips64

naming feedback from kettenis@ and millert@
ok kettenis@


# 1.17 20-Aug-2015 deraadt

All these files include <stdlib.h>, so do not need to cast
malloc/calloc/realloc* returns.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 09-Nov-2009 kurt

Fix the handle locking in stdio to use flockfile/funlockfile
internally when and where required. Macros in <stdio.h> are updated
to automatically call the underlying functions when the process is
threaded to obtain the necessary locking. A private mutex is added
to protect __sglue, the internal list of FILE handles, and another
to protect the one-time initialization. Some routines in libc that
use getc() change to use getc_unlocked() as they're either protected
by their own lock or aren't thread-safe routines anyway.

committing on behalf of and okay guenther@ now that we have install
media space available.


# 1.15 22-Oct-2009 guenther

Back out previous commit, as it caused too much growth for the install
media to fit


# 1.14 21-Oct-2009 guenther

Fix the handle locking in stdio to use flockfile/funlockfile
internally when and where required. Macros in <stdio.h> are updated
to automatically call the underlying functions when the process is
threaded to obtain the necessary locking. A private mutex is added
to protect __sglue, the internal list of FILE handles, and another
to protect the one-time initialization. Some routines in libc that
use getc() change to use getc_unlocked() as they're either protected
by their own lock or aren't thread-safe routines anyway.

ok kurt@, earlier version tested by sthen@ and jj@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.13 06-Jan-2006 millert

Adapt things to use __type_t instead of _BSD_TYPE_T_
Add new sys/_types.h header
Include machine/_types.h or sys/_types.h where applicable


# 1.12 10-Oct-2005 espie

Remove a few warnings. Those were not apparent thanks to a bug in gcc 2.95.

Patch by Leonardo Chiquitto Filho <leonardo@iken.com.br>
Thanks.


Revision tags: OPENBSD_3_8_BASE
# 1.11 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.10 30-Apr-2005 espie

Change internals of FILE: reuse the unget buffer field to access an
extended attribute data structure (pimpl idiom). Idea taken from citrus.
Much discussion with deraadt@, otto@, millert@...

This is the least disruptive way to extend FILE, since its size can't really
change without this being a flag day. So the size doesn't change.

Actual additions to the structure will come in separate steps, since this
change is nasty enough on its own.

Tests by otto@ and others, careful reading of code by otto@ and millert@.

This is definitely a major bump, and has been checked to not impact a
full ports build.


Revision tags: OPENBSD_3_7_BASE
# 1.9 28-Sep-2004 otto

deregister + ansify, no change in object code. ok deraadt@ millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.8 17-Jun-2003 millert

Sync with share/misc/license.template and add missing DARPA credit
where applicable.


# 1.7 03-Jun-2003 millert

Use an ISC-tyle license for all my code; it is simpler and more permissive.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.6 16-Oct-1998 millert

Make sure we free the buffer in all error cases. Do the final
realloc(3) to the size of the string, not the size of the buffer
allocated for the string (which is a noop). mycroft@netbsd.org


# 1.5 14-Aug-1998 deraadt

realloc repair


# 1.4 21-Jun-1998 millert

Remove the advertising clause in my old license, it impedes free use
of the code as a large number of similar clauses makes it impossible
to write an ad for a product using the code...


Revision tags: OPENBSD_2_3_BASE
# 1.3 07-Feb-1998 tholo

Cast pointer in assignment


# 1.2 12-Jan-1998 millert

Based on some FreeBSD changes:
For *s*printf, set f._file to -1 like the comments in stdio.h say.
Use '\0', not 0, where appropriate.
Don't error out on size of '0' for v?snprintf().


# 1.1 29-Nov-1997 millert

Implement asprintf(3) and vasprintf(3) functions similar to the
ones in the glibc. Some man pages changes from FreeBSD
(asprintf.c/vasprintf.c are not based on GNU or FreeBSD code).