From patchwork Mon Jun 3 09:40:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13683483 Received: from wfhigh7-smtp.messagingengine.com (wfhigh7-smtp.messagingengine.com [64.147.123.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1FEB83A18 for ; Mon, 3 Jun 2024 09:40:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717407608; cv=none; b=YQuHHflFIJHdB5SiXEex8jL9FyVtJZlGu4iZpL3Yqog5E8AG+lPeQtjy3f1nZxyu8RSkt3JkrU1OUtzfSTUpZdP6bd+EfK55KAu6xE0fUHKvyROVXSNmqHjN+pK50Ox4BUYo27VwylmjtqhMNOUD0oW7BxMJqOGif91bU2fPp6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717407608; c=relaxed/simple; bh=rDolCkU/1RHVGKBe5J1LK4/pfPcX28tUeojKvRFqYts=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WPXDjU864hTjW8nCzg716KlZwGvYee+lFUAgTwY/P5rJH6LT2kkHfylwFjdjUSYWv1SZGRwpJp6UFTRKP3ciVd1IVCBt5QPy+YJgn5ot+IzCMsN/VCeMUZ76p0HyYqSdlLc65D/mekAr1A5oVGtUDVobAkVzdRzgov+bORxwflQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=EkUA/J6d; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=EOgxQELX; arc=none smtp.client-ip=64.147.123.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="EkUA/J6d"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="EOgxQELX" Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfhigh.west.internal (Postfix) with ESMTP id 13125180009D; Mon, 3 Jun 2024 05:40:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 03 Jun 2024 05:40:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1717407605; x=1717494005; bh=mZ0c0GUxD/ dnbUgUJ+kbmEi4QYl/MhYLClQO17fv1ZY=; b=EkUA/J6dO93EZSvfYA/l1CVtIl QsfysnV0BoamTThts0cAgZ3CxcsTutM55ux41Phtjoaqtm+DIPhAvpmPhmk9xLQT jlDpsiS0bWluP3RecY0vYzb6kgdm5g4nvnrILKttaaqA4oFwkIA4dertjPW3m5ae Kko3lmzoVuSJJGD4VslzU4T7Lq+IQ4X5GWgRN3OroJoUQ5BO8S5EkVxWcMhZEbmX Bm4owQ5/xb9DEGp1WU7ErUVLRwBiF++6j9n5mKiDv15Ymeh6YMEcURletkj6GnIF 6+qOIqKEoMDay8JKT1n9Pl/iF9Lgcb7/kjNAmYb06MoFSsuebNsiMCj4thVA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1717407605; x=1717494005; bh=mZ0c0GUxD/dnbUgUJ+kbmEi4QYl/ MhYLClQO17fv1ZY=; b=EOgxQELXqUcKgjaksR+NEUx18aTUi2ZYjvwZJvLyKG+5 XI1AZFkPSeAM6WIjOp8zEuRM4CS47MakxZRw5hjUXe2MvqM2tN/uqsszofsD98o2 oATPln70rhn6Too/y8oqVRUoMaoq8S9knuoFqw6t77h9Weh6+RX+Jyq9igjtPs2k GgrQyjxvhQuB83OO4dDSGvnwUmMhZcZyMm39su6bGfSnYqgFnzaV4Sc+pmLiYpId 9977UFaFqPBTw3I2vWPWbMJhusCT5up6uxJ1FxGfTIQQnwya2P5kMi0xYGbRzTjR k7bNxanIxHzFdkJp3xKnrcMfOV2JRlThDY3Smx1C1A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelvddgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfhfgggtuggjsehgtd erredttddvnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshes phhkshdrihhmqeenucggtffrrghtthgvrhhnpeeukedtvedtffevleejtefgheehieegke eluddvfeefgeehgfeltddtheejleffteenucevlhhushhtvghrufhiiigvpedvnecurfgr rhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 Jun 2024 05:40:04 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id 9c79041e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 3 Jun 2024 09:39:40 +0000 (UTC) Date: Mon, 3 Jun 2024 11:40:02 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH v3 14/27] pretty: add casts for decoration option pointers Message-ID: <4d95abe9ccd41f97733995c06ba41ebeef584ac9.1717402403.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The `struct decoration_options` have a prefix and suffix field which are both non-constant, but we assign a constant pointer to them. This is safe to do because we pass them to `format_decorations()`, which never modifies these pointers, and then immediately discard the structure. Add explicit casts to avoid compilation warnings with `-Wwrite-strings`. Signed-off-by: Patrick Steinhardt --- pretty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pretty.c b/pretty.c index ec05db5655..1df9d635fb 100644 --- a/pretty.c +++ b/pretty.c @@ -1584,8 +1584,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ case 'D': { const struct decoration_options opts = { - .prefix = "", - .suffix = "" + .prefix = (char *) "", + .suffix = (char *) "", }; format_decorations(sb, commit, c->auto_color, &opts);