1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-16 18:47:32 -05:00

Rename FROMFIELD to 'container_of'.

Ian Jackson points out that the Linux kernel has a macro of this name
with the same purpose, and suggests that it's a good idea to use the
same name as they do, so that at least some people reading one code
base might recognise it from the other.

I never really thought very hard about what order FROMFIELD's
parameters should go in, and therefore I'm pleasantly surprised to
find that my order agrees with the kernel's, so I don't have to
permute every call site as part of making this change :-)
This commit is contained in:
Simon Tatham
2018-10-05 23:49:08 +01:00
parent ed652a70e8
commit 9396fcc9f7
47 changed files with 410 additions and 399 deletions

View File

@ -107,7 +107,7 @@ BinaryPacketProtocol *ssh_verstring_new(
void ssh_verstring_free(BinaryPacketProtocol *bpp)
{
struct ssh_verstring_state *s =
FROMFIELD(bpp, struct ssh_verstring_state, bpp);
container_of(bpp, struct ssh_verstring_state, bpp);
conf_free(s->conf);
sfree(s->vstring);
sfree(s->protoversion);
@ -213,7 +213,7 @@ static void ssh_verstring_send(struct ssh_verstring_state *s)
void ssh_verstring_handle_input(BinaryPacketProtocol *bpp)
{
struct ssh_verstring_state *s =
FROMFIELD(bpp, struct ssh_verstring_state, bpp);
container_of(bpp, struct ssh_verstring_state, bpp);
crBegin(s->crState);
@ -604,21 +604,21 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
const char *ssh_verstring_get_remote(BinaryPacketProtocol *bpp)
{
struct ssh_verstring_state *s =
FROMFIELD(bpp, struct ssh_verstring_state, bpp);
container_of(bpp, struct ssh_verstring_state, bpp);
return s->vstring;
}
const char *ssh_verstring_get_local(BinaryPacketProtocol *bpp)
{
struct ssh_verstring_state *s =
FROMFIELD(bpp, struct ssh_verstring_state, bpp);
container_of(bpp, struct ssh_verstring_state, bpp);
return s->our_vstring;
}
int ssh_verstring_get_bugs(BinaryPacketProtocol *bpp)
{
struct ssh_verstring_state *s =
FROMFIELD(bpp, struct ssh_verstring_state, bpp);
container_of(bpp, struct ssh_verstring_state, bpp);
return s->remote_bugs;
}