From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: 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, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 4B7821F5AE for ; Thu, 30 Jul 2020 23:41:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730644AbgG3XlT (ORCPT ); Thu, 30 Jul 2020 19:41:19 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:61111 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728047AbgG3XlS (ORCPT ); Thu, 30 Jul 2020 19:41:18 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id A694F63101; Thu, 30 Jul 2020 19:41:16 -0400 (EDT) (envelope-from junio@pobox.com) 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=FehPfsPqR4bHfmbNHNgDZ0idlFE=; b=mHyLCc +VGm4BDyKTExrmy0qhYyesRR1tB9Ht6ilTVn69H+zLYQEfeslZN1Yln+vzNzz1ku fkSwQbZVGza0jRUAhj99/UU5spWmgrOPH9XHdbR7blxVwblN/TtMieJ4iXHlIZ1B GwjnuxIZBLjpA02HOim9bTnJgZvQPOPOOL+vc= 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=KC2iqdIqpHAxojlh2sCjrcWO1inU2N/i pEdAQYnTw0DF0cVDJ3AnXfIV/K+3bUnVJ4w899cgd13ckrFsOEYNb4IHe5F0Pbfg 3HWF4SMLauzL94FToKhA/c2MV7iXFTUwjPUWLCR6uFYeUvUFFtFkJSNd1QGPdzEh a6sIJr2JXDI= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 9E50D63100; Thu, 30 Jul 2020 19:41:16 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [35.196.173.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 2C10B630FF; Thu, 30 Jul 2020 19:41:16 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Emily Shaffer Cc: git@vger.kernel.org, Jeff King Subject: Re: [RFC PATCH v3 5/6] parse-options: parse into argv_array References: <20200728222455.3023400-1-emilyshaffer@google.com> <20200728222455.3023400-6-emilyshaffer@google.com> Date: Thu, 30 Jul 2020 16:41:15 -0700 In-Reply-To: (Junio C. Hamano's message of "Wed, 29 Jul 2020 12:33:39 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 29042D14-D2BE-11EA-90C9-01D9BED8090B-77302942!pb-smtp1.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Junio C Hamano writes: > Be it argv_array or strvec, I think this is a useful thing to do. > > I grepped for the users of OPT_STRING_LIST() to see if some of them > are better served by this, but none of them stood out as candidates > that are particularly good match. > >> +int parse_opt_argv_array(const struct option *opt, const char *arg, int unset) >> +{ >> + struct argv_array *v = opt->value; >> + >> + if (unset) { >> + argv_array_clear(v); >> + return 0; >> + } >> + >> + if (!arg) >> + return -1; > > I think the calling parse_options() loop would catch this negative > return and raise an error, but is it better for this code to stay > silent or would it be better to say that opt->long_name/short_name > is not a boolean? I am still waiting for this to be answered, but I queued the whole topic, these last two steps included, just to see how bad adjusting to the strvec API migration would be. It wasn't too bad. I would not recommend you, or other contributors who use argv-array API in their topics, to build on top of jk/strvec, not just yet, as I expect it to go through at least one more reroll to update the details. Thanks.