]> www.infradead.org Git - mtd-utils.git/commitdiff
mtd-tests: io_paral: build error, "variable length strings"
authorBrian Norris <computersforpeace@gmail.com>
Mon, 27 Jun 2011 18:27:19 +0000 (11:27 -0700)
committerArtem Bityutskiy <dedekind1@gmail.com>
Wed, 29 Jun 2011 05:42:38 +0000 (08:42 +0300)
Some compilers will complain about use of strlen() within a static array
size declaration. For this type of string, "sizeof() - 1" is equivalent
and prevents the build error.

Error:

   io_paral.c:48:13: error: variably modified 'vol_nodes' at file scope

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
tests/ubi-tests/io_paral.c

index 9754a0d8e594b831f4b2bb4662f991fce20148f6..1d9a97ce0654cc34e3863ef6d116231a4c8bee82 100644 (file)
@@ -45,7 +45,7 @@ static int vol_size;
 
 static struct ubi_mkvol_request reqests[THREADS_NUM + 1];
 static char vol_name[THREADS_NUM + 1][100];
-static char vol_nodes[THREADS_NUM + 1][strlen(UBI_VOLUME_PATTERN) + 100];
+static char vol_nodes[THREADS_NUM + 1][sizeof(UBI_VOLUME_PATTERN) + 99];
 static unsigned char *wbufs[THREADS_NUM + 1];
 static unsigned char *rbufs[THREADS_NUM + 1];