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: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 884681F4B5 for ; Wed, 20 Nov 2019 00:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727566AbfKTAvT (ORCPT ); Tue, 19 Nov 2019 19:51:19 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:34651 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727226AbfKTAvT (ORCPT ); Tue, 19 Nov 2019 19:51:19 -0500 Received: by mail-pl1-f196.google.com with SMTP id h13so12951776plr.1 for ; Tue, 19 Nov 2019 16:51:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kU+Q6G8qopZi4s0dWF3JcdVw7ZV4xtAispcHmOihLU0=; b=GZQ+jjDKPwGHj04dVjTUYCRc9OoWVAQh6GkPr/82V7rT/gqSlcwZ8MpU5dAV5meFXn +noujpJbdgoOX5xRCan5vifkHxAtVLJVM2aiKRJsx+hnlx0d1tiHY1igLJTwOZp7W1NR 0ri4mXDOT/mgd4UpVDvnUMm99akS1mOYOCh0ECRi59KvcVeas6RL+CRHD57Dhyazcu3T 7aeB3bMBNGehq5kOV1gcdYb7gLvdgTHeFkLZEhu/oHFJn5BMS4eUR4kJsd7VeH8PDfWI ipr8zLkJWQjFRFjh5bIU78cyzcU52IkNktvmKxo62qYHNF5ivw9IxgoSIww/OSvqSQt8 vehQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kU+Q6G8qopZi4s0dWF3JcdVw7ZV4xtAispcHmOihLU0=; b=JJsE7cBQ2A2Q80+kQ4GDmyDPGXJbqpJVKOFOxxyYndWT7Q7jrM4w2xNdI08mUvf+sx P2HiAKs8dHqHZhf4fRX5WUegZieu0OywWjAfhKpHAA0BUFjR5/p52vCn3tGfaqGCwFO0 fKpjfJzjm+GBX2Ajw1bzM4jv1+X1cgA48vYfrlg3F1YYzj7mn8QsihRMb0ShoEZ7NceS ocQSeJkJXnsO1jwKA2LvHGBrwQts+5Mbl2QYAozd8sCrP8vGPKb3vGZDy3bCSOII3U/g kYTWWqIXjT6dQBWSiAh0d0BwVRPlORs3+SCdEtoKkdyLqiIS6OD3LVqwo0R1E6e7e+jK hGSg== X-Gm-Message-State: APjAAAVJWvorgcOKibreQHqrTzR0MWYLOg0FKLU7ksKR+qIi1ZrDHN21 VXRf0v/1FLkkp4cqdum/ZLut38YF X-Google-Smtp-Source: APXvYqyGtN+VkIKW/xV7z4hngMDO7+GE3fwLqos/wA0NrbgP3e/DH1v4O95IV+m2G7M9DF9AEyHjOQ== X-Received: by 2002:a17:90a:a4e:: with SMTP id o72mr532691pjo.66.1574211078481; Tue, 19 Nov 2019 16:51:18 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id a68sm26445248pfa.160.2019.11.19.16.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2019 16:51:17 -0800 (PST) Date: Tue, 19 Nov 2019 16:51:16 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Junio C Hamano , =?utf-8?B?UmVuw6k=?= Scharfe , SZEDER =?utf-8?B?R8OhYm9y?= , Todd Zullinger Subject: [PATCH v5 06/11] pretty.c: inline initalize format_context Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Instead of memsetting and then initializing the fields in the struct, move the initialization of `format_context` to its assignment. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- pretty.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pretty.c b/pretty.c index e4ed14effe..da154affd4 100644 --- a/pretty.c +++ b/pretty.c @@ -1612,14 +1612,14 @@ void repo_format_commit_message(struct repository *r, const char *format, struct strbuf *sb, const struct pretty_print_context *pretty_ctx) { - struct format_commit_context context; + struct format_commit_context context = { + .commit = commit, + .pretty_ctx = pretty_ctx, + .wrap_start = sb->len + }; const char *output_enc = pretty_ctx->output_encoding; const char *utf8 = "UTF-8"; - memset(&context, 0, sizeof(context)); - context.commit = commit; - context.pretty_ctx = pretty_ctx; - context.wrap_start = sb->len; /* * convert a commit message to UTF-8 first * as far as 'format_commit_item' assumes it in UTF-8 -- 2.24.0.420.g9ac4901264