Skip to contentSkip to conversation

bios-tables-test: use strlen instead of sizeof

PATCH New [email protected] 1 participant 1 message Aug 15, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bios-tables-test: use strlen instead of sizeof

From: Wei Yang <[email protected]>

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.

---
 tests/bios-tables-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/bios-tables-test.c +1 -1
index 88dbf97853..d1f31b19d3 100644
@@ -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;
Signature · 1 line
2.11.0