Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1258551
| From | Pranith Kumar <bobby.prani@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] llist: Use for conditional in llist_del_first() |
| Date | 2015-10-29 05:00 +0100 |
| Message-ID | <qoMxA-3r0-3@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Simplify the code a bit by using the initializer and conditional
check in for() instead of a separate if() statement in the loop.
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
lib/llist.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/llist.c b/lib/llist.c
index 0b0e977..03d7aad 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -66,10 +66,7 @@ struct llist_node *llist_del_first(struct llist_head *head)
{
struct llist_node *entry, *old_entry, *next;
- entry = head->first;
- for (;;) {
- if (entry == NULL)
- return NULL;
+ for (entry = head->first; entry ;) {
old_entry = entry;
next = entry->next;
entry = cmpxchg(&head->first, old_entry, next);
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] llist: Use for conditional in llist_del_first() Pranith Kumar <bobby.prani@gmail.com> - 2015-10-29 05:00 +0100
csiph-web