1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Remove a lot of pointless 'struct' keywords.

This is the commit that f3295e0fb _should_ have been. Yesterday I just
added some typedefs so that I didn't have to wear out my fingers
typing 'struct' in new code, but what I ought to have done is to move
all the typedefs into defs.h with the rest, and then go through
cleaning up the legacy 'struct's all through the existing code.

But I was mostly trying to concentrate on getting the test suite
finished, so I just did the minimum. Now it's time to come back and do
it better.
This commit is contained in:
Simon Tatham
2019-01-04 06:51:44 +00:00
parent abebfdf0dd
commit 35690040fd
39 changed files with 452 additions and 449 deletions

View File

@ -24,7 +24,7 @@
static int key_type_fp(FILE *fp);
static int rsa_ssh1_load_main(FILE * fp, struct RSAKey *key, bool pub_only,
static int rsa_ssh1_load_main(FILE * fp, RSAKey *key, bool pub_only,
char **commentptr, const char *passphrase,
const char **error)
{
@ -141,7 +141,7 @@ static int rsa_ssh1_load_main(FILE * fp, struct RSAKey *key, bool pub_only,
return ret;
}
int rsa_ssh1_loadkey(const Filename *filename, struct RSAKey *key,
int rsa_ssh1_loadkey(const Filename *filename, RSAKey *key,
const char *passphrase, const char **errorstr)
{
FILE *fp;
@ -218,7 +218,7 @@ int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs,
{
FILE *fp;
char buf[64];
struct RSAKey key;
RSAKey key;
int ret;
const char *error = NULL;
@ -310,7 +310,7 @@ int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs,
/*
* Save an RSA key file. Return true on success.
*/
bool rsa_ssh1_savekey(const Filename *filename, struct RSAKey *key,
bool rsa_ssh1_savekey(const Filename *filename, RSAKey *key,
char *passphrase)
{
strbuf *buf = strbuf_new();
@ -563,7 +563,7 @@ static bool read_blob(FILE *fp, int nlines, BinarySink *bs)
/*
* Magic error return value for when the passphrase is wrong.
*/
struct ssh2_userkey ssh2_wrong_passphrase = { NULL, NULL };
ssh2_userkey ssh2_wrong_passphrase = { NULL, NULL };
const ssh_keyalg *find_pubkey_alg_len(ptrlen name)
{
@ -588,14 +588,13 @@ const ssh_keyalg *find_pubkey_alg(const char *name)
return find_pubkey_alg_len(ptrlen_from_asciz(name));
}
struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
const char *passphrase,
const char **errorstr)
ssh2_userkey *ssh2_load_userkey(
const Filename *filename, const char *passphrase, const char **errorstr)
{
FILE *fp;
char header[40], *b, *encryption, *comment, *mac;
const ssh_keyalg *alg;
struct ssh2_userkey *ret;
ssh2_userkey *ret;
int cipher, cipherblk;
strbuf *public_blob, *private_blob;
int i;
@ -797,7 +796,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
/*
* Create and return the key.
*/
ret = snew(struct ssh2_userkey);
ret = snew(ssh2_userkey);
ret->comment = comment;
ret->key = ssh_key_new_priv(
alg, ptrlen_from_strbuf(public_blob),
@ -1235,8 +1234,8 @@ void base64_encode(FILE *fp, const unsigned char *data, int datalen, int cpl)
fputc('\n', fp);
}
bool ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
char *passphrase)
bool ssh2_save_userkey(
const Filename *filename, ssh2_userkey *key, char *passphrase)
{
FILE *fp;
strbuf *pub_blob, *priv_blob;
@ -1356,7 +1355,7 @@ bool ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
/* ----------------------------------------------------------------------
* Output public keys.
*/
char *ssh1_pubkey_str(struct RSAKey *key)
char *ssh1_pubkey_str(RSAKey *key)
{
char *buffer;
char *dec1, *dec2;
@ -1371,7 +1370,7 @@ char *ssh1_pubkey_str(struct RSAKey *key)
return buffer;
}
void ssh1_write_pubkey(FILE *fp, struct RSAKey *key)
void ssh1_write_pubkey(FILE *fp, RSAKey *key)
{
char *buffer = ssh1_pubkey_str(key);
fprintf(fp, "%s\n", buffer);
@ -1418,7 +1417,7 @@ static char *ssh2_pubkey_openssh_str_internal(const char *comment,
return buffer;
}
char *ssh2_pubkey_openssh_str(struct ssh2_userkey *key)
char *ssh2_pubkey_openssh_str(ssh2_userkey *key)
{
strbuf *blob;
char *ret;