[systemd-devel] [PATCH] libudev: enumerate: fix NULL-deref for subsystem-matches

Lennart Poettering lennart at poettering.net
Mon Sep 9 18:28:11 PDT 2013


On Fri, 30.08.13 17:22, Colin Guthrie (gmane at colin.guthr.ie) wrote:

> 
> 'Twas brillig, and David Herrmann at 30/08/13 14:50 did gyre and gimble:
> > +        subsystem = subsystem ? : "";
> > +
> 
> zomg!!11eleven! This makes perfect sense but somehow this is the first
> time I've seen this syntax before where the value between ? and : is
> inherited from the test itself... nice!
> 
> For what it's worth the two other uses of this syntax in the systemd
> codebase don't have a space between the ? and : (dunno if this qualifies
> for a coding standard tho'!)
> 
> /me will now go and craw back under his rock...

btw, for this specific usecase we have a macro strempty(), which hides
the ternary operator... We generally prefer using that...

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list