Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/defs.h
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2018-10-06 01:49:08 +0300
committerSimon Tatham <anakin@pobox.com>2018-10-06 09:28:51 +0300
commit9396fcc9f7fbece620fcf602f734b35ee921740b (patch)
tree62ea2c2deb1299376c88f83e8eeb68fafc6b9f07 /defs.h
parented652a70e80ae505a2b0e3302b0d2640df6a0e05 (diff)
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 :-)
Diffstat (limited to 'defs.h')
-rw-r--r--defs.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/defs.h b/defs.h
index 776ab888..0d98b70c 100644
--- a/defs.h
+++ b/defs.h
@@ -97,7 +97,7 @@ typedef struct PacketProtocolLayer PacketProtocolLayer;
/* Return a pointer to the object of structure type 'type' whose field
* with name 'field' is pointed at by 'object'. */
-#define FROMFIELD(object, type, field) \
+#define container_of(object, type, field) \
TYPECHECK(object == &((type *)0)->field, \
((type *)(((char *)(object)) - offsetof(type, field))))