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=-3.7 required=3.0 tests=AWL,BAYES_00, 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 80A001F55B for ; Tue, 19 May 2020 16:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729205AbgESQXz (ORCPT ); Tue, 19 May 2020 12:23:55 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:35556 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728689AbgESQXz (ORCPT ); Tue, 19 May 2020 12:23:55 -0400 Received: by mail-wm1-f68.google.com with SMTP id n5so4346156wmd.0 for ; Tue, 19 May 2020 09:23:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ybthD4DLMGuDCpSv4ZDU+luA7NWljd56TO5LX2rbgGg=; b=BXGQ/p7iLOTTEdxXqqZdJKOMZWALWzIkbyxY7F3Zf5FqG06i9bGvhTwPlGX2g3PfWD 3x+pfMWx110geyVXrCRy5GULmgeUun0JrO7aO8I3QJHRzjcpPRFVGLWngQ5H1SLMs+pK mmwarNW2dtHETagvr/0m/bexUyPWyglDYEQjGIKb6a1Jpmq42H+bvMGqAyFGmjYPbctY Gmg7pdznNynnhb8/wlekDztrAOYvRSb2BYelPntsTh1Zf7EW3zh2Bvp2qR6c1X4bdhP1 RsAl5zOhwQTBmIoIQCNHGUkLwXVVTcE1cQyoCGLVY4+CRx35cNWuBKXOhcOfmV8jjbjA mQ+g== X-Gm-Message-State: AOAM532dRHJXK5tRTCxKYCWJOvPCXfI6xG8GmqHsThMynhDgQk1KfPxS fi3rMhIUd7JVqgcZUwwkwRs+6drWO1L8yOa657A= X-Google-Smtp-Source: ABdhPJyDnptxMhdY5slphud0IhFXt0R5lrEcLpVhX/hcpUULMmec0mDl0+6D5xsyyZulcjdf7ZSYIE9MlqyOkh/BveE= X-Received: by 2002:a1c:2702:: with SMTP id n2mr169878wmn.107.1589905433301; Tue, 19 May 2020 09:23:53 -0700 (PDT) MIME-Version: 1.0 References: <36885943b239807eda49e231d8a45e1991f7288e.1589885479.git.liu.denton@gmail.com> In-Reply-To: <36885943b239807eda49e231d8a45e1991f7288e.1589885479.git.liu.denton@gmail.com> From: Eric Sunshine Date: Tue, 19 May 2020 12:23:42 -0400 Message-ID: Subject: Re: [PATCH v3 4/7] pkt-line: extern packet_length() To: Denton Liu Cc: Git Mailing List , Jeff King , Junio C Hamano Content-Type: text/plain; charset="UTF-8" Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Tue, May 19, 2020 at 6:54 AM Denton Liu wrote: > [...] > Change the function parameter from `const char *linelen` to > `const char lenbuf_hex[4]`. Even though these two types behave > identically as function parameters, use the array notation to > semantically indicate exactly what this function is expecting as an > argument. Also, rename it from linelen to lenbuf_hex as the former > sounds like it should be an integral type which is misleading. > > Signed-off-by: Denton Liu > --- > diff --git a/pkt-line.h b/pkt-line.h > @@ -74,6 +74,15 @@ int write_packetized_from_buf(const char *src_in, size_t len, int fd_out); > +/* > + * Convert a four hex digit packet line length header into its numeric > + * representation. > + * > + * If linelen contains non-hex characters, return -1. Otherwise, return the s/linelen/lenbuf_hex/ ...or... s/lenbuf_hex/input argument/ > + * numeric value of the length header. > + */ > +int packet_length(const char lenbuf_hex[4]);