From patchwork Fri May 24 12:37:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10959797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFC56112C for ; Fri, 24 May 2019 12:38:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBA3A28732 for ; Fri, 24 May 2019 12:38:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF728287B5; Fri, 24 May 2019 12:38:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 616D328736 for ; Fri, 24 May 2019 12:38:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hU9Rz-0003Fr-BI; Fri, 24 May 2019 12:37:31 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hU9Rx-0003Fi-Pk for xen-devel@lists.xenproject.org; Fri, 24 May 2019 12:37:29 +0000 X-Inumbo-ID: b06a0166-7e20-11e9-8980-bc764e045a96 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id b06a0166-7e20-11e9-8980-bc764e045a96; Fri, 24 May 2019 12:37:27 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Fri, 24 May 2019 06:37:27 -0600 Message-Id: <5CE7E5830200007800232051@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.1 Date: Fri, 24 May 2019 06:37:23 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH] vsprintf: constify "end" parameters X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Except in the top level function we don't mean to ever write through "end". The variable is used solely for pointer comparison purposes there. Add const everywhere. Also make function heading wrapping style uniform again for all of the involved functions. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- a/xen/common/vsprintf.c +++ b/xen/common/vsprintf.c @@ -144,7 +144,7 @@ static int skip_atoi(const char **s) #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ static char *number( - char *buf, char *end, unsigned long long num, + char *buf, const char *end, unsigned long long num, int base, int size, int precision, int type) { char c,sign,tmp[66]; @@ -238,7 +238,7 @@ static char *number( return buf; } -static char *string(char *str, char *end, const char *s, +static char *string(char *str, const char *end, const char *s, int field_width, int precision, int flags) { int i, len = (precision < 0) ? strlen(s) : strnlen(s, precision); @@ -265,8 +265,9 @@ static char *string(char *str, char *end } /* Print a bitmap as '0-3,6-15' */ -static char *print_bitmap_list( - char *str, char *end, const unsigned long *bitmap, unsigned int nr_bits) +static char *print_bitmap_list(char *str, const char *end, + const unsigned long *bitmap, + unsigned int nr_bits) { /* current bit is 'cur', most recently seen range is [rbot, rtop] */ unsigned int cur, rbot, rtop; @@ -306,8 +307,9 @@ static char *print_bitmap_list( } /* Print a bitmap as a comma separated hex string. */ -static char *print_bitmap_string( - char *str, char *end, const unsigned long *bitmap, unsigned int nr_bits) +static char *print_bitmap_string(char *str, const char *end, + const unsigned long *bitmap, + unsigned int nr_bits) { const unsigned int CHUNKSZ = 32; unsigned int chunksz; @@ -347,7 +349,7 @@ static char *print_bitmap_string( } /* Print a domain id, using names for system domains. (e.g. d0 or d[IDLE]) */ -static char *print_domain(char *str, char *end, const struct domain *d) +static char *print_domain(char *str, const char *end, const struct domain *d) { const char *name = NULL; @@ -378,7 +380,7 @@ static char *print_domain(char *str, cha } /* Print a vcpu id. (e.g. d0v1 or d[IDLE]v0) */ -static char *print_vcpu(char *str, char *end, const struct vcpu *v) +static char *print_vcpu(char *str, const char *end, const struct vcpu *v) { /* Some debugging may have an optionally-NULL pointer. */ if ( unlikely(!v) ) @@ -392,7 +394,7 @@ static char *print_vcpu(char *str, char return number(str + 1, end, v->vcpu_id, 10, -1, -1, 0); } -static char *pointer(char *str, char *end, const char **fmt_ptr, +static char *pointer(char *str, const char *end, const char **fmt_ptr, const void *arg, int field_width, int precision, int flags) {