summaryrefslogtreecommitdiff
path: root/lab02/container_of.h
diff options
context:
space:
mode:
Diffstat (limited to 'lab02/container_of.h')
-rw-r--r--lab02/container_of.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/lab02/container_of.h b/lab02/container_of.h
index 6383572..87fb6d4 100644
--- a/lab02/container_of.h
+++ b/lab02/container_of.h
@@ -11,7 +11,13 @@
#define typeof_member(T, m) typeof(((T*)0)->m)
-
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr: the pointer to the member.
+ * @type: the type of the container struct this is embedded in.
+ * @member: the name of the member within the struct.
+ *
+ */
#define container_of(ptr, type, member) ({ \
_Static_assert(__same_type(*(ptr), typeof_member(type, member)) || \
__same_type(*(ptr), void), \