Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id BC7104196F4 for ; Tue, 6 Apr 2010 01:31:15 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.5 X-Spam-Level: X-Spam-Status: No, score=-0.5 tagged_above=-999 required=5 tests=[BAYES_05=-0.5, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uU09xtZoHo6G for ; Tue, 6 Apr 2010 01:31:15 -0700 (PDT) Received: from mail-ew0-f219.google.com (mail-ew0-f219.google.com [209.85.219.219]) by olra.theworths.org (Postfix) with ESMTP id D74354196F0 for ; Tue, 6 Apr 2010 01:31:14 -0700 (PDT) Received: by ewy19 with SMTP id 19so4516ewy.2 for ; Tue, 06 Apr 2010 01:31:14 -0700 (PDT) Received: by 10.213.47.83 with SMTP id m19mr391919ebf.92.1270542673844; Tue, 06 Apr 2010 01:31:13 -0700 (PDT) Received: from ut.hh.sledj.net (host83-217-165-81.dsl.vispa.com [83.217.165.81]) by mx.google.com with ESMTPS id t12sm26928143gvd.6.2010.04.06.01.31.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 06 Apr 2010 01:31:12 -0700 (PDT) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id 842805941EC; Tue, 6 Apr 2010 09:31:09 +0100 (BST) To: Anthony Towns Subject: Re: [PATCH] json: Avoid calling strlen(NULL) In-Reply-To: References: <877holavq5.fsf@ut.hh.sledj.net> From: David Edmondson Date: Tue, 06 Apr 2010 09:31:09 +0100 Message-ID: <874ojpasoi.fsf@ut.hh.sledj.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: notmuch X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2010 08:31:15 -0000 On Tue, 6 Apr 2010 18:17:44 +1000, Anthony Towns 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