Skip to contentSkip to conversation

unit: Remove loop initial declaration.

PATCH Applied Ossama Othman 2 participants 2 messages Feb 26, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unit: Remove loop initial declaration.

Move the variable declaration in test_string.c:test_strv_append() out of the for-loop initial declaration to support older C standards, as well as to conform to the ELL coding style.

---
 unit/test-string.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
unit/test-string.c +3 -3
index 710617b..d8aebcb 100644
@@ -257,15 +257,15 @@ static void test_strv_append(const void *test_data)
 {
 	const char *src[] = { "Foo", "Bar" };
 	char **dst = NULL;
-
 	size_t len = L_ARRAY_SIZE(src);
+	size_t i;
 
-	for (size_t i = 0; i < len; i++)
+	for (i = 0; i < len; i++)
 		dst = l_strv_append(dst, src[i]);
 
 	assert(l_strv_length(dst) == len);
 
-	for (size_t i = 0; i < len; i++)
+	for (i = 0; i < len; i++)
 		assert(strcmp(src[i], dst[i]) == 0);
 
         l_strv_free(dst);
Signature · 1 line
2.17.1
#1 lore raw

Hi Ossama,

Quoted 7 lines · Ossama Othman

Move the variable declaration in test_string.c:test_strv_append() out of the for-loop initial declaration to support older C standards, as well as to conform to the ELL coding style.

---
  unit/test-string.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Regards,
-Denis