svn rev #19595: trunk/src/ include/ lib/krb5/keytab/ util/support/

raeburn@MIT.EDU raeburn at MIT.EDU
Tue Jun 19 21:09:11 EDT 2007


Commit By: raeburn
Log Message: 
ticket: new
subject: provide asprintf functionality for internal use

I plan to use asprintf in some gssapi error-message management
routines, so let's make sure we have the functionality available,
implementing it locally if necessary.

This implementation assumes vsnprintf is available, an assumption that
the support library is already making at the moment.

Since this implementation requires calling vsnprintf potentially
multiple times with the same va_list, use va_copy if it's available,
or provide a hack version (which should work okay if va_list is a
scalar or array type that requires no other special handling, and if
va_end does nothing interesting, which is usually the case) if the
compiler doesn't provide it.

I also changed a couple bits of code to use asprintf, to make sure we
exercise our implementation in testing.

(C99 requires vsnprintf and va_copy; vasprintf is a GNU/BSD extension,
but an oh so useful one....)


* configure.in: Check for va_copy, or if va_list objects can be simply
assigned.  Define HAS_VA_COPY and CAN_COPY_VA_LIST as appropriate.
* include/k5-platform.h: Define a va_copy macro if the compiler
doesn't provide it.

* include/k5-platform.h: If vsnprintf isn't available from the OS,
abort compilation.  If vasprintf isn't available from the OS, provide
k5_{v,}asprintf based on vsnprintf and define {v,}asprintf macros.
* lib/krb5/keytab/t_keytab.c (do_test): Use asprintf.
* util/support/errors.c (krb5int_vset_error): Use asprintf
unconditionally.



Changed Files:
U   trunk/src/configure.in
U   trunk/src/include/k5-platform.h
U   trunk/src/lib/krb5/keytab/t_keytab.c
U   trunk/src/util/support/errors.c



More information about the cvs-krb5 mailing list