@@ -832,7 +832,8 @@ static int compute_generation_numbers(git_vector *commits)
832832 * (size_t * )git_array_alloc (index_stack ) = i ;
833833
834834 while (git_array_size (index_stack )) {
835- i = * git_array_pop (index_stack );
835+ size_t * index_ptr = git_array_pop (index_stack );
836+ i = * index_ptr ;
836837 child_packed_commit = git_vector_get (commits , i );
837838
838839 if (commit_states [i ] == GENERATION_NUMBER_COMMIT_STATE_VISITED ) {
@@ -1017,6 +1018,7 @@ commit_graph_write(git_commit_graph_writer *w, commit_graph_write_cb write_cb, v
10171018 uint64_t commit_time ;
10181019 uint32_t generation ;
10191020 uint32_t word ;
1021+ size_t * packed_index ;
10201022 unsigned int parentcount = (unsigned int )git_array_size (packed_commit -> parents );
10211023
10221024 error = git_buf_put (
@@ -1026,30 +1028,38 @@ commit_graph_write(git_commit_graph_writer *w, commit_graph_write_cb write_cb, v
10261028 if (error < 0 )
10271029 goto cleanup ;
10281030
1029- if (parentcount == 0 )
1031+ if (parentcount == 0 ) {
10301032 word = htonl (GIT_COMMIT_GRAPH_MISSING_PARENT );
1031- else
1032- word = htonl ((uint32_t )* git_array_get (packed_commit -> parent_indices , 0 ));
1033+ } else {
1034+ packed_index = git_array_get (packed_commit -> parent_indices , 0 );
1035+ word = htonl ((uint32_t )* packed_index );
1036+ }
10331037 error = git_buf_put (& commit_data , (const char * )& word , sizeof (word ));
10341038 if (error < 0 )
10351039 goto cleanup ;
10361040
1037- if (parentcount < 2 )
1041+ if (parentcount < 2 ) {
10381042 word = htonl (GIT_COMMIT_GRAPH_MISSING_PARENT );
1039- else if (parentcount == 2 )
1040- word = htonl ((uint32_t )* git_array_get (packed_commit -> parent_indices , 1 ));
1041- else
1043+ } else if (parentcount == 2 ) {
1044+ packed_index = git_array_get (packed_commit -> parent_indices , 1 );
1045+ word = htonl ((uint32_t )* packed_index );
1046+ } else {
10421047 word = htonl (0x80000000u | extra_edge_list_count );
1048+ }
10431049 error = git_buf_put (& commit_data , (const char * )& word , sizeof (word ));
10441050 if (error < 0 )
10451051 goto cleanup ;
10461052
10471053 if (parentcount > 2 ) {
10481054 unsigned int parent_i ;
10491055 for (parent_i = 1 ; parent_i < parentcount ; ++ parent_i ) {
1050- word = htonl ((uint32_t )(
1051- * git_array_get (packed_commit -> parent_indices , parent_i )
1052- | (parent_i + 1 == parentcount ? 0x80000000u : 0 )));
1056+ packed_index = git_array_get (
1057+ packed_commit -> parent_indices , parent_i );
1058+ word = htonl (
1059+ (uint32_t )(* packed_index
1060+ | (parent_i + 1 == parentcount
1061+ ? 0x80000000u
1062+ : 0 )));
10531063 error = git_buf_put (
10541064 & extra_edge_list ,
10551065 (const char * )& word ,
0 commit comments