Re: [PATCH] json: Avoid calling strlen(NULL)

Subject: Re: [PATCH] json: Avoid calling strlen(NULL)

Date: Tue, 06 Apr 2010 09:31:09 +0100

To: Anthony Towns

Cc: notmuch

From: David Edmondson


On Tue, 6 Apr 2010 18:17:44 +1000, Anthony Towns <aj@erisian.com.au> wrote:
> OTOH, the code in json_quote_array to deal with that does the same
> thing (returns a literal string containing two quote marks), which
> seems wrong -- the normal code path is to talloc to get a newly
> allocated, editable string, that might be talloc_free'd later,
> wouldn't it make more sense just to let the str==NULL / len==0
> behaviour fall through into the normal case code?

This is a much nicer solution.

dme.
-- 
David Edmondson, http://dme.org

Thread: