[PATCH v2 3/6] reflog-walk.c: use string_list_init_dup()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change init_reflog_walk() to use the helper function added in
183113a5ca9 (string_list: Add STRING_LIST_INIT macro and make use of
it., 2010-07-04) rather than assuming that the "struct string_list"
part of "struct reflog_walk_info" can be memset() to 0, followed by
flipping ".strdup_strings = 1".

As explained in a preceding commit that can be assumed now if we peek
behind the guts of the "struct string_list", but there's no reason to
break the encapsulation here.

This does not match the newly added "struct string_list" rule for
changing CALLOC_ARRAY() followed by ".strdup_strings = 1" to
"ALLOC_ARRAY()" and "string_list_init_dup()" because here the
"CALLOC_ARRAY()" is allocating more than just the "struct
string_list".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 reflog-walk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/reflog-walk.c b/reflog-walk.c
index 7aa6595a51f..2b17408f9a4 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -120,7 +120,7 @@ struct reflog_walk_info {
 void init_reflog_walk(struct reflog_walk_info **info)
 {
 	CALLOC_ARRAY(*info, 1);
-	(*info)->complete_reflogs.strdup_strings = 1;
+	string_list_init_dup(&((*info)->complete_reflogs));
 }
 
 void reflog_walk_info_release(struct reflog_walk_info *info)
-- 
2.37.1.1095.g64a1e8362fd




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux