From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id C26996DE0BA5 for ; Sat, 3 Aug 2019 08:15:26 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.051 X-Spam-Level: X-Spam-Status: No, score=-0.051 tagged_above=-999 required=5 tests=[AWL=-0.050, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zhdnMuofz-3b for ; Sat, 3 Aug 2019 08:15:25 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id CD0356DE0ABA for ; Sat, 3 Aug 2019 08:15:25 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1htvkf-0002d6-AT; Sat, 03 Aug 2019 11:15:21 -0400 Received: (nullmailer pid 942 invoked by uid 1000); Sat, 03 Aug 2019 15:15:30 -0000 From: David Bremner To: Daniel Kahn Gillmor , Notmuch Mail Subject: Re: [PATCH 5/7] util/repair: add _notmuch_repair_crypto_payload_skip_legacy_display In-Reply-To: <20190625014107.12452-6-dkg@fifthhorseman.net> References: <20190625014107.12452-1-dkg@fifthhorseman.net> <20190625014107.12452-6-dkg@fifthhorseman.net> Date: Sat, 03 Aug 2019 12:15:30 -0300 Message-ID: <87blx6wa99.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 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: Sat, 03 Aug 2019 15:15:26 -0000 Daniel Kahn Gillmor writes: > + ret = true; > + for (int i = 0; i < g_mime_header_list_get_count (legacy_display_headers); i++) { > + GMimeHeader *dh = g_mime_header_list_get_header_at (legacy_display_headers, i); > + if (dh == NULL) { > + ret = false; > + break; > + } I can live with the use of break if you think it's superior, but I think the idiom of "goto DONE" is more common in the notmuch codebase. I personally always have think about the semantics of "break" and "continue" in C pretty carefully. > + if (strcmp (g_mime_header_get_value (dh), g_mime_header_get_value (ph))) { > + ret = false; > + break; > + } It's not really clear to me what kind of "invalid" causes g_mime_header_get_value to return NULL. Maybe this strcmp should be guarded against that?