diff --git a/misc.c b/misc.c index f4334a04..1a528923 100644 --- a/misc.c +++ b/misc.c @@ -337,6 +337,12 @@ void burnstr(char *string) /* sfree(str), only clear it first */ } } +void logevent_and_free(Frontend *frontend, char *s) +{ + logevent(frontend, s); + sfree(s); +} + int toint(unsigned u) { /* diff --git a/misc.h b/misc.h index 242d1a94..40191724 100644 --- a/misc.h +++ b/misc.h @@ -31,6 +31,13 @@ char *dupprintf(const char *fmt, ...) char *dupvprintf(const char *fmt, va_list ap); void burnstr(char *string); +/* + * Pass a dynamically allocated string to logevent and immediately + * free it. Intended for use by wrapper macros which pass the return + * value of dupprintf straight to this. + */ +void logevent_and_free(Frontend *frontend, char *msg); + struct strbuf { char *s; unsigned char *u; diff --git a/ssh.h b/ssh.h index a0085179..8a411710 100644 --- a/ssh.h +++ b/ssh.h @@ -777,8 +777,6 @@ int random_byte(void); void random_add_noise(void *noise, int length); void random_add_heavynoise(void *noise, int length); -void logevent(Frontend *, const char *); - /* Exports from x11fwd.c */ enum { X11_TRANS_IPV4 = 0, X11_TRANS_IPV6 = 6, X11_TRANS_UNIX = 256 diff --git a/testbn.c b/testbn.c index 05f62767..16529e27 100644 --- a/testbn.c +++ b/testbn.c @@ -7,6 +7,7 @@ * testdata/bignum.py. */ +#include #include #include #include @@ -31,6 +32,8 @@ int random_byte(void) return 0; } +void logevent(Frontend *frontend, const char *msg) { assert(0); } + #define fromxdigit(c) ( (c)>'9' ? ((c)&0xDF) - 'A' + 10 : (c) - '0' ) /* For Unix in particular, but harmless if this main() is reused elsewhere */ diff --git a/windows/winpgen.c b/windows/winpgen.c index d2840113..d951fa6b 100644 --- a/windows/winpgen.c +++ b/windows/winpgen.c @@ -60,6 +60,9 @@ void nonfatal(const char *fmt, ...) sfree(stuff); } +/* Stub needed to link against misc.c */ +void logevent(Frontend *frontend, const char *msg) { assert(0); } + /* ---------------------------------------------------------------------- * Progress report code. This is really horrible :-) */ diff --git a/windows/winpgnt.c b/windows/winpgnt.c index 3734ab17..0f89b810 100644 --- a/windows/winpgnt.c +++ b/windows/winpgnt.c @@ -113,6 +113,9 @@ static void unmungestr(char *in, char *out, int outlen) return; } +/* Stub needed to link against misc.c */ +void logevent(Frontend *frontend, const char *msg) { assert(0); } + static int has_security; struct PassphraseProcStruct {