mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
New utility function logevent_and_free.
This should make it easier to do formatted-string based logging outside ssh.c, because I can wrap up a local macro in any source file I like that expands to logevent_and_free(wherever my Frontend is, dupprintf(macro argument)). It caused yet another stub function to be needed in testbn, but there we go. (Also, while I'm here, removed a redundant declaration of logevent itself from ssh.h. The one in putty.h is all we need.)
This commit is contained in:
parent
61f18ac451
commit
a313048763
6
misc.c
6
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)
|
int toint(unsigned u)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
7
misc.h
7
misc.h
@ -31,6 +31,13 @@ char *dupprintf(const char *fmt, ...)
|
|||||||
char *dupvprintf(const char *fmt, va_list ap);
|
char *dupvprintf(const char *fmt, va_list ap);
|
||||||
void burnstr(char *string);
|
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 {
|
struct strbuf {
|
||||||
char *s;
|
char *s;
|
||||||
unsigned char *u;
|
unsigned char *u;
|
||||||
|
2
ssh.h
2
ssh.h
@ -777,8 +777,6 @@ int random_byte(void);
|
|||||||
void random_add_noise(void *noise, int length);
|
void random_add_noise(void *noise, int length);
|
||||||
void random_add_heavynoise(void *noise, int length);
|
void random_add_heavynoise(void *noise, int length);
|
||||||
|
|
||||||
void logevent(Frontend *, const char *);
|
|
||||||
|
|
||||||
/* Exports from x11fwd.c */
|
/* Exports from x11fwd.c */
|
||||||
enum {
|
enum {
|
||||||
X11_TRANS_IPV4 = 0, X11_TRANS_IPV6 = 6, X11_TRANS_UNIX = 256
|
X11_TRANS_IPV4 = 0, X11_TRANS_IPV6 = 6, X11_TRANS_UNIX = 256
|
||||||
|
3
testbn.c
3
testbn.c
@ -7,6 +7,7 @@
|
|||||||
* testdata/bignum.py.
|
* testdata/bignum.py.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -31,6 +32,8 @@ int random_byte(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void logevent(Frontend *frontend, const char *msg) { assert(0); }
|
||||||
|
|
||||||
#define fromxdigit(c) ( (c)>'9' ? ((c)&0xDF) - 'A' + 10 : (c) - '0' )
|
#define fromxdigit(c) ( (c)>'9' ? ((c)&0xDF) - 'A' + 10 : (c) - '0' )
|
||||||
|
|
||||||
/* For Unix in particular, but harmless if this main() is reused elsewhere */
|
/* For Unix in particular, but harmless if this main() is reused elsewhere */
|
||||||
|
@ -60,6 +60,9 @@ void nonfatal(const char *fmt, ...)
|
|||||||
sfree(stuff);
|
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 :-)
|
* Progress report code. This is really horrible :-)
|
||||||
*/
|
*/
|
||||||
|
@ -113,6 +113,9 @@ static void unmungestr(char *in, char *out, int outlen)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Stub needed to link against misc.c */
|
||||||
|
void logevent(Frontend *frontend, const char *msg) { assert(0); }
|
||||||
|
|
||||||
static int has_security;
|
static int has_security;
|
||||||
|
|
||||||
struct PassphraseProcStruct {
|
struct PassphraseProcStruct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user