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-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, 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 2949B1F5AE for ; Fri, 30 Apr 2021 22:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231316AbhD3WW2 (ORCPT ); Fri, 30 Apr 2021 18:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230290AbhD3WW1 (ORCPT ); Fri, 30 Apr 2021 18:22:27 -0400 Received: from mav.lukeshu.com (mav.lukeshu.com [IPv6:2001:19f0:5c00:8069:5400:ff:fe26:6a86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F19D4C06174A for ; Fri, 30 Apr 2021 15:21:38 -0700 (PDT) Received: from lukeshu-dw-thinkpad (unknown [IPv6:2601:281:8200:26:4e34:88ff:fe48:5521]) by mav.lukeshu.com (Postfix) with ESMTPSA id 6487080590; Fri, 30 Apr 2021 18:21:33 -0400 (EDT) Date: Fri, 30 Apr 2021 16:21:32 -0600 Message-ID: <878s4zpg5v.wl-lukeshu@lukeshu.com> From: Luke Shumaker To: Elijah Newren Cc: Luke Shumaker , Junio C Hamano , Git Mailing List , Jeff King , Johannes Schindelin , =?UTF-8?B?Tmd1eeG7hW4g?= =?ISO-8859-1?Q?Th=E1i_?= =?UTF-8?B?Tmfhu41j?= Duy , Taylor Blau , "brian m . carlson" , Eric Sunshine , Luke Shumaker Subject: Re: [PATCH v3 3/3] fast-export, fast-import: implement signed-commits In-Reply-To: References: <20210422002749.2413359-1-lukeshu@lukeshu.com> <20210423164118.693197-1-lukeshu@lukeshu.com> <20210423164118.693197-4-lukeshu@lukeshu.com> <87a6pfpnvt.wl-lukeshu@lukeshu.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, 30 Apr 2021 13:59:43 -0600, Elijah Newren wrote: > > On Fri, Apr 30, 2021 at 12:34 PM Luke Shumaker wrote: > > > > On Tue, 27 Apr 2021 22:02:47 -0600, > > Junio C Hamano wrote: > > > Better yet, don't butcher the region of memory pointed by the > > > "message" variable the caller uses to keep reading from the > > > remainder of the commit object buffer with this and memmove() > > > below. Perhaps have the caller pass a strbuf to fill in the > > > signature found by this helper as another parameter, and then return > > > a bool "Yes, I found a sig" as its return value? > > > > Stupid question: is there a better way to append a region of bytes to > > a strbuf than > > > > strbuf_addf(&buf, "%.*s", (int)(str_end - str_beg), str); > > > > ? > > > > It seems weird to me to invoke the printf machinery for something so > > simple, but I don't see anything alternatives in strbuf.h. Am I > > missing something? > > I struggled to find it some time ago as well; I wonder if some > reorganization of strbuf.[ch] might make it more clear. > > Anyway, strbuf_add() if you have the number of bytes already handy, > strbuf_addstr() if you don't have the number of bytes handy but the > string is NUL-delimited. Ah! I was looking for `char *`, but strbuf_add takes a `void *`, that's why I didn't find it. Thank you! -- Happy hacking, ~ Luke Shumaker