[ruby-cvs:54727] normal:r47579 (trunk): ccan/container_of: add container_of_or_null

normal at ruby-lang.org normal at ruby-lang.org
Sun Sep 14 08:49:29 JST 2014

normal	2014-09-14 08:49:28 +0900 (Sun, 14 Sep 2014)

  New Revision: 47579


    ccan/container_of: add container_of_or_null
    * ccan/container_of/container_of.h (container_of_or_null): added
      [ccan 7ec5b8e06b2fd5fa98b1fcde1158c286d2d429d8] (David Gibson)
    It's quite common to have a pointer which could be either a pointer to a
    structure member, or NULL.  This needs special casing with container_of(),
    or it will convert NULL into something strange.
    This patch adds container_of_or_null(), which will return NULL if passed
    (an appropriately typed) NULL, or the containining structure as
    container_of() otherwise.

  Modified files:

More information about the ruby-cvs mailing list