> There's already a check in json_quote_chararray for len==0, so it > might be sensible to say: > > return (json_quote_chararray (ctx, str, str != NULL ? strlen (str) : 0)); > > 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? Yes, that's the correct analysis. Thanks so much. > commit 5b93a488221b50c02db18d86a550cb3c038c00da > Author: Anthony <aj@erisian.com.au> > Date: Tue Apr 6 18:10:39 2010 +1000 > > json: Avoid calling strlen(NULL), and always return a newly > talloced array. I've pushed this out now, (separated into two pieces). -Carl