* [Qemu-devel] [PATCH] bios-tables-test: use strlen instead of sizeof
@ 2017-08-15 5:04 wei.yang
0 siblings, 0 replies; only message in thread
From: wei.yang @ 2017-08-15 5:04 UTC (permalink / raw)
To: mst; +Cc: qemu-devel, wei.yang
From: Wei Yang <wei.yang@ucloud.cn>
sizeof(BLOCK_NAME_END) is actually 2. it can work
because there's a space after ,. but It is better to
replace it with strlen so it will work without a space too.
Signed-off-by: Wei Yang <wei.yang@ucloud.cn>
CC: Michael S. Tsirkin <mst@redhat.com>
CC: qemu-devel@nongnu.org
---
tests/bios-tables-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index 88dbf97853..d1f31b19d3 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -352,7 +352,7 @@ static GString *normalize_asl(gchar *asl_code)
block_name = g_strstr_len(asl->str, asl->len, BLOCK_NAME_END);
g_assert(block_name);
asl = g_string_erase(asl, 0,
- block_name + sizeof(BLOCK_NAME_END) - asl->str);
+ block_name + strlen(BLOCK_NAME_END) - asl->str);
}
return asl;
--
2.11.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-08-15 5:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-15 5:04 [Qemu-devel] [PATCH] bios-tables-test: use strlen instead of sizeof wei.yang
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).