From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88438C433B4 for ; Mon, 5 Apr 2021 16:14:57 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 48E1261025 for ; Mon, 5 Apr 2021 16:14:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48E1261025 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.105452.201851 (Exim 4.92) (envelope-from ) id 1lTRsA-0005V5-Ct; Mon, 05 Apr 2021 16:14:42 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 105452.201851; Mon, 05 Apr 2021 16:14:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lTRsA-0005Uu-6H; Mon, 05 Apr 2021 16:14:42 +0000 Received: by outflank-mailman (input) for mailman id 105452; Mon, 05 Apr 2021 16:14:39 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lTRs7-0005U6-PK for xen-devel@lists.xenproject.org; Mon, 05 Apr 2021 16:14:39 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lTRs6-0003eu-H5; Mon, 05 Apr 2021 16:14:38 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lTRbW-00053b-W8; Mon, 05 Apr 2021 15:57:31 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=fOozlpcQqX3U35FdV5utWkSVhrMD0HRaxwSjYqjDLQU=; b=s3UuLNW5J0CRb7QQWuy3WCObx 9Gdg6FRWFWbkIYxzFKoZOv2val092fE4cOQzcRm4YVQZ31kwcWJ3NT60CRP2B9jujZTo3yvvEONJz 7FInxspUOxEYrqmX/FCyAO/5RTJMMjSXJx9QixNpURGdf4BHNYESij6Ke2nVKGjrv2FC4=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Ian Jackson , Wei Liu Subject: [PATCH 11/14] tools/misc: Use const whenever we point to literal strings Date: Mon, 5 Apr 2021 16:57:10 +0100 Message-Id: <20210405155713.29754-12-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210405155713.29754-1-julien@xen.org> References: <20210405155713.29754-1-julien@xen.org> From: Julien Grall literal strings are not meant to be modified. So we should use const char * rather than char * when we we to store a pointer to them. Signed-off-by: Julien Grall --- tools/misc/xen-detect.c | 2 +- tools/misc/xenhypfs.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/misc/xen-detect.c b/tools/misc/xen-detect.c index eac9e46a35bb..18b28dabf311 100644 --- a/tools/misc/xen-detect.c +++ b/tools/misc/xen-detect.c @@ -44,7 +44,7 @@ enum guest_type { XEN_NONE = 3 }; -static char *type; +static const char *type; static char *ver; static void cpuid(uint32_t idx, uint32_t *regs, int pv_context) diff --git a/tools/misc/xenhypfs.c b/tools/misc/xenhypfs.c index 5da24aed905c..df398b07bdc0 100644 --- a/tools/misc/xenhypfs.c +++ b/tools/misc/xenhypfs.c @@ -81,9 +81,9 @@ static int xenhypfs_wr(char *path, char *val) return ret; } -static char *xenhypfs_type(struct xenhypfs_dirent *ent) +static const char *xenhypfs_type(struct xenhypfs_dirent *ent) { - char *res; + const char *res; switch (ent->type) { case xenhypfs_type_dir: @@ -134,7 +134,7 @@ static int xenhypfs_ls(char *path) return ret; } -static int xenhypfs_tree_sub(char *path, unsigned int depth) +static int xenhypfs_tree_sub(const char *path, unsigned int depth) { struct xenhypfs_dirent *ent; unsigned int n, i; -- 2.17.1