Skip Menu |

Subject: SVN Commit
Download (untitled) / with headers
text/plain 1.5KiB
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....)

* 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

Commit By: raeburn

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