logeventf.c 809 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Helpful wrapper functions around the raw logevent().
  3. *
  4. * This source file lives in 'utils' because it's conceptually a
  5. * convenience utility rather than core functionality. But it can't
  6. * live in the utils _library_, because then it might refer to
  7. * logevent() in an earlier library after Unix ld had already finished
  8. * searching that library, and cause a link failure. So it must live
  9. * alongside logging.c.
  10. */
  11. #include "putty.h"
  12. void logevent_and_free(LogContext *ctx, char *event)
  13. {
  14. logevent(ctx, event);
  15. sfree(event);
  16. }
  17. void logeventvf(LogContext *ctx, const char *fmt, va_list ap)
  18. {
  19. logevent_and_free(ctx, dupvprintf(fmt, ap));
  20. }
  21. void logeventf(LogContext *ctx, const char *fmt, ...)
  22. {
  23. va_list ap;
  24. va_start(ap, fmt);
  25. logeventvf(ctx, fmt, ap);
  26. va_end(ap);
  27. }