lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130603193647.GB10200@logfs.org>
Date:	Mon, 3 Jun 2013 15:36:47 -0400
From:	Jörn Engel <joern@...fs.org>
To:	Christoph Hellwig <hch@...radead.org>
Cc:	linux-kernel@...r.kernel.org,
	Chris Mason <chris.mason@...ionio.com>,
	linux-btrfs@...r.kernel.org
Subject: Re: [PATCH 0/2] introduce list_for_each_entry_del

On Mon, 3 June 2013 13:49:30 -0700, Christoph Hellwig wrote:
> 
> I can't say I like the structure.
> 
> A list_pop that removes and entry from the head or returns NULL if the
> list is empty would lead to nice while loops that are obviously
> readable instead.

Something like this?

#define list_pop(head) \
        ({ struct list_head *____pos; \
           list_empty(head) ? NULL : (____pos = (head)->next, \
                   list_del(____pos), ____pos) \
        })

#define list_pop_entry(head, type, member) \
        ({ struct list_head *____pos; \
           list_empty(head) ? NULL : (____pos = (head)->next, \
                   list_del(____pos), list_entry(____pos, type, member) \
        })

Would be fine with me as well.

Jörn

--
Beware of bugs in the above code; I have only proved it correct, but
not tried it.
-- Donald Knuth
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ