All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] block/qapi: Fix Sparse warning
@ 2015-03-07 22:16 ` Stefan Weil
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2015-03-07 22:16 UTC (permalink / raw)
  To: QEMU Trivial; +Cc: Kevin Wolf, Stefan Weil, QEMU Developer, Stefan Hajnoczi

Sparse reports this warning:

block/qapi.c:417:47: warning:
 too long initializer-string for array of char(no space for nul char)

Replacing the string by an array of characters fixes this warning.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 block/qapi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/qapi.c b/block/qapi.c
index 1808e67..8a19aed 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -414,7 +414,7 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
 
 static char *get_human_readable_size(char *buf, int buf_size, int64_t size)
 {
-    static const char suffixes[NB_SUFFIXES] = "KMGT";
+    static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'};
     int64_t base;
     int i;
 
-- 
2.1.4



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

* [Qemu-devel] [PATCH] block/qapi: Fix Sparse warning
@ 2015-03-07 22:16 ` Stefan Weil
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2015-03-07 22:16 UTC (permalink / raw)
  To: QEMU Trivial; +Cc: Kevin Wolf, Stefan Weil, QEMU Developer, Stefan Hajnoczi

Sparse reports this warning:

block/qapi.c:417:47: warning:
 too long initializer-string for array of char(no space for nul char)

Replacing the string by an array of characters fixes this warning.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 block/qapi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/qapi.c b/block/qapi.c
index 1808e67..8a19aed 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -414,7 +414,7 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
 
 static char *get_human_readable_size(char *buf, int buf_size, int64_t size)
 {
-    static const char suffixes[NB_SUFFIXES] = "KMGT";
+    static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'};
     int64_t base;
     int i;
 
-- 
2.1.4

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

* Re: [Qemu-trivial] [PATCH] block/qapi: Fix Sparse warning
  2015-03-07 22:16 ` [Qemu-devel] " Stefan Weil
@ 2015-03-10  6:06   ` Michael Tokarev
  -1 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2015-03-10  6:06 UTC (permalink / raw)
  To: Stefan Weil, QEMU Trivial; +Cc: Kevin Wolf, QEMU Developer, Stefan Hajnoczi

08.03.2015 01:16, Stefan Weil wrote:
> Sparse reports this warning:
> 
> block/qapi.c:417:47: warning:
>  too long initializer-string for array of char(no space for nul char)
> 
> Replacing the string by an array of characters fixes this warning.

> -    static const char suffixes[NB_SUFFIXES] = "KMGT";
> +    static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'};

The latter is a bit uglier to my taste but oh well, damn warnings! :)

Applied to -trivial, thanks!

/mjt



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

* Re: [Qemu-devel] [PATCH] block/qapi: Fix Sparse warning
@ 2015-03-10  6:06   ` Michael Tokarev
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2015-03-10  6:06 UTC (permalink / raw)
  To: Stefan Weil, QEMU Trivial; +Cc: Kevin Wolf, QEMU Developer, Stefan Hajnoczi

08.03.2015 01:16, Stefan Weil wrote:
> Sparse reports this warning:
> 
> block/qapi.c:417:47: warning:
>  too long initializer-string for array of char(no space for nul char)
> 
> Replacing the string by an array of characters fixes this warning.

> -    static const char suffixes[NB_SUFFIXES] = "KMGT";
> +    static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'};

The latter is a bit uglier to my taste but oh well, damn warnings! :)

Applied to -trivial, thanks!

/mjt

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

end of thread, other threads:[~2015-03-10  6:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-07 22:16 [Qemu-trivial] [PATCH] block/qapi: Fix Sparse warning Stefan Weil
2015-03-07 22:16 ` [Qemu-devel] " Stefan Weil
2015-03-10  6:06 ` [Qemu-trivial] " Michael Tokarev
2015-03-10  6:06   ` [Qemu-devel] " Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.