From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id B2D2820899 for ; Thu, 17 Aug 2017 21:20:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753246AbdHQVUt (ORCPT ); Thu, 17 Aug 2017 17:20:49 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:54345 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752609AbdHQVUs (ORCPT ); Thu, 17 Aug 2017 17:20:48 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 5565CAD9D3; Thu, 17 Aug 2017 17:20:48 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=+PzPKqD+t41gw285owTlmS+VrTA=; b=S38q7A CLz6yYOSR2zknUivGwkb8vMthBJZKWjE0PUH6r1kr51Ml12uwxfGAWpqX0CP9hJF 0j3lsK4Xdh9HGi43DctZVKbqwaM/aEq6gYQkIM/skOUGofFWIkLcKjGnDmvGCuor VMsuzQhiFAPyAigFxDxZ8/Lu+Kp2WVHgwIjW0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=JMhZ6PQqF1uIiBDd+uAwABXSmU3XHNf2 rYwymm7Z1WTq93ngrdxBPlLcVz2F7zqa7UJt6+Q1n1rS1zkrRc0Ki4Nkex43WJCg DNc+/N+VMTdnO5dv7anJiNw78+GiMBhA3A4b27qNgx9a3ptwi1drh8LScYJEz/nE Sbr4m77VyJY= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 4EC90AD9D2; Thu, 17 Aug 2017 17:20:48 -0400 (EDT) Received: from pobox.com (unknown [104.132.0.95]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id BA538AD9CE; Thu, 17 Aug 2017 17:20:47 -0400 (EDT) From: Junio C Hamano To: Patryk Obara Cc: git@vger.kernel.org, sandals@crustytoothpaste.net, Stefan Beller , Jonathan Nieder Subject: Re: [PATCH v2 4/4] commit: rewrite read_graft_line References: Date: Thu, 17 Aug 2017 14:20:46 -0700 In-Reply-To: (Patryk Obara's message of "Wed, 16 Aug 2017 19:58:25 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: EFFAB25A-8391-11E7-9C99-9D2B0D78B957-77302942!pb-smtp2.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Patryk Obara writes: > The previous implementation of read_graft_line used calculations based > on GIT_SHA1_RAWSZ and GIT_SHA1_HEXSZ to determine the number of commit > ids in a single graft line. New implementation does not depend on these > constants, so it adapts to any object_id buffer size. > > To make this possible, FLEX_ARRAY of object_id in struct was replaced > by an oid_array. There is a leap in logic between the two paragraphs. Your use of parse_oid_hex() is good. But I do not think moving the array body to outside commit_graft structure and forcing it to be separately allocated is necessary or beneficial. When we got a single line, we know how many fake parents a child described by that graft line has, and you can still use of FLEX_ARRAY to avoid separate allocation and need for separate freeing of it.