X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibudev%2Flibudev-list.c;h=aec334bcfc52875b25a622ec27b7f33a7241c2e6;hb=c2a623d842af3a4d67e1f4e365f6d6a47f1c6cb4;hp=054c0a931cdf0905627228c51b601a40420b4772;hpb=bb061708d5aa83579f213bdfb67253f7027217c3;p=elogind.git diff --git a/src/libudev/libudev-list.c b/src/libudev/libudev-list.c index 054c0a931..aec334bcf 100644 --- a/src/libudev/libudev-list.c +++ b/src/libudev/libudev-list.c @@ -80,13 +80,9 @@ void udev_list_node_remove(struct udev_list_node *entry) } /* return list entry which embeds this node */ -static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) +static inline struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) { - char *list; - - list = (char *)node; - list -= offsetof(struct udev_list_entry, node); - return (struct udev_list_entry *)list; + return container_of(node, struct udev_list_entry, node); } void udev_list_init(struct udev *udev, struct udev_list *list, bool unique) @@ -261,7 +257,9 @@ struct udev_list_entry *udev_list_get_entry(struct udev_list *list) * udev_list_entry_get_next: * @list_entry: current entry * - * Returns: the next entry from the list, #NULL is no more entries are found. + * Get the next entry from the list. + * + * Returns: udev_list_entry, #NULL if no more entries are available. */ _public_ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) { @@ -281,7 +279,9 @@ _public_ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry * @list_entry: current entry * @name: name string to match * - * Returns: the entry where @name matched, #NULL if no matching entry is found. + * Lookup an entry in the list with a certain name. + * + * Returns: udev_list_entry, #NULL if no matching entry is found. */ _public_ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) { @@ -303,6 +303,8 @@ _public_ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_en * udev_list_entry_get_name: * @list_entry: current entry * + * Get the name of a list entry. + * * Returns: the name string of this entry. */ _public_ const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) @@ -316,6 +318,8 @@ _public_ const char *udev_list_entry_get_name(struct udev_list_entry *list_entry * udev_list_entry_get_value: * @list_entry: current entry * + * Get the value of list entry. + * * Returns: the value string of this entry. */ _public_ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry)