From: Derrick Stolee Date: Fri, 20 Mar 2026 16:31:07 GMT Subject: Re: [PATCH] cocci: strbuf.buf is never NULL Message-ID: <228bfbe3-af2d-49b7-984e-cae7b1b8af28@gmail.com> In-Reply-To: On 3/19/2026 6:39 PM, Junio C Hamano wrote: > We recently noticed one old code from 19 years ago protecting > against an ancient strbuf convention that the .buf member can be > NULL for an empty strbuf. As that is no longer the case in the > modern codebase, let's catch such a construct. > +// In modern codebase, .buf member of an empty strbuf is not NULL. > +@@ > +struct strbuf SB; > +@@ > +- SB.buf ? SB.buf : "" > ++ SB.buf LGTM. I like to see these structural patterns encoded as rules. Thanks, -Stolee