mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Move the logeventf wrappers into their own source file.
Separating them from logging.c allows them to be shared between the real logging.c and the new stub no-logging.c.
This commit is contained in:
parent
334d4f315e
commit
23c408d49d
@ -18,7 +18,7 @@ add_subdirectory(utils)
|
||||
add_subdirectory(stubs)
|
||||
|
||||
add_library(logging OBJECT
|
||||
logging.c)
|
||||
logging.c utils/logeventf.c)
|
||||
|
||||
add_library(eventloop STATIC
|
||||
callback.c timing.c)
|
||||
@ -34,7 +34,8 @@ add_library(crypto STATIC
|
||||
add_subdirectory(crypto)
|
||||
|
||||
add_library(network STATIC
|
||||
errsock.c logging.c x11disp.c
|
||||
errsock.c x11disp.c
|
||||
$<TARGET_OBJECTS:logging>
|
||||
proxy/proxy.c
|
||||
proxy/http.c
|
||||
proxy/socks4.c
|
||||
|
20
logging.c
20
logging.c
@ -253,26 +253,6 @@ void logevent(LogContext *ctx, const char *event)
|
||||
}
|
||||
}
|
||||
|
||||
void logevent_and_free(LogContext *ctx, char *event)
|
||||
{
|
||||
logevent(ctx, event);
|
||||
sfree(event);
|
||||
}
|
||||
|
||||
void logeventvf(LogContext *ctx, const char *fmt, va_list ap)
|
||||
{
|
||||
logevent_and_free(ctx, dupvprintf(fmt, ap));
|
||||
}
|
||||
|
||||
void logeventf(LogContext *ctx, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
logeventvf(ctx, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/*
|
||||
* Log an SSH packet.
|
||||
* If n_blanks != 0, blank or omit some parts.
|
||||
|
@ -52,10 +52,10 @@ add_sources_from_current_dir(agent
|
||||
|
||||
add_executable(fuzzterm
|
||||
${CMAKE_SOURCE_DIR}/test/fuzzterm.c
|
||||
${CMAKE_SOURCE_DIR}/logging.c
|
||||
${CMAKE_SOURCE_DIR}/stubs/no-print.c
|
||||
unicode.c
|
||||
no-gtk.c)
|
||||
no-gtk.c
|
||||
$<TARGET_OBJECTS:logging>)
|
||||
be_list(fuzzterm FuZZterm)
|
||||
add_dependencies(fuzzterm generated_licence_h)
|
||||
target_link_libraries(fuzzterm
|
||||
|
32
utils/logeventf.c
Normal file
32
utils/logeventf.c
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Helpful wrapper functions around the raw logevent().
|
||||
*
|
||||
* This source file lives in 'utils' because it's conceptually a
|
||||
* convenience utility rather than core functionality. But it can't
|
||||
* live in the utils _library_, because then it might refer to
|
||||
* logevent() in an earlier library after Unix ld had already finished
|
||||
* searching that library, and cause a link failure. So it must live
|
||||
* alongside logging.c.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
|
||||
void logevent_and_free(LogContext *ctx, char *event)
|
||||
{
|
||||
logevent(ctx, event);
|
||||
sfree(event);
|
||||
}
|
||||
|
||||
void logeventvf(LogContext *ctx, const char *fmt, va_list ap)
|
||||
{
|
||||
logevent_and_free(ctx, dupvprintf(fmt, ap));
|
||||
}
|
||||
|
||||
void logeventf(LogContext *ctx, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
logeventvf(ctx, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
Loading…
Reference in New Issue
Block a user