xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vsprintf: constify "end" parameters
@ 2019-05-24 12:37 Jan Beulich
  2019-05-24 12:37 ` [Xen-devel] " Jan Beulich
  2019-05-24 12:44 ` Andrew Cooper
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Beulich @ 2019-05-24 12:37 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall

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 <jbeulich@suse.com>

--- 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)
 {





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Xen-devel] [PATCH] vsprintf: constify "end" parameters
  2019-05-24 12:37 [PATCH] vsprintf: constify "end" parameters Jan Beulich
@ 2019-05-24 12:37 ` Jan Beulich
  2019-05-24 12:44 ` Andrew Cooper
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2019-05-24 12:37 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall

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 <jbeulich@suse.com>

--- 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)
 {





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vsprintf: constify "end" parameters
  2019-05-24 12:37 [PATCH] vsprintf: constify "end" parameters Jan Beulich
  2019-05-24 12:37 ` [Xen-devel] " Jan Beulich
@ 2019-05-24 12:44 ` Andrew Cooper
  2019-05-24 12:44   ` [Xen-devel] " Andrew Cooper
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2019-05-24 12:44 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall

On 24/05/2019 13:37, Jan Beulich wrote:
> 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 <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xen-devel] [PATCH] vsprintf: constify "end" parameters
  2019-05-24 12:44 ` Andrew Cooper
@ 2019-05-24 12:44   ` Andrew Cooper
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2019-05-24 12:44 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall

On 24/05/2019 13:37, Jan Beulich wrote:
> 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 <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-24 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-24 12:37 [PATCH] vsprintf: constify "end" parameters Jan Beulich
2019-05-24 12:37 ` [Xen-devel] " Jan Beulich
2019-05-24 12:44 ` Andrew Cooper
2019-05-24 12:44   ` [Xen-devel] " Andrew Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).