tree-diff: simplify tree_entry_pathcmp
Since an earlier "Finally switch over tree descriptors to contain a pre-parsed entry", we can safely access all tree_desc->entry fields directly instead of first "extracting" them through tree_entry_extract. Use it. The code generated stays the same - only it now visually looks cleaner. Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		
				
					committed by
					
						
						Junio C Hamano
					
				
			
			
				
	
			
			
			
						parent
						
							5acabd84a6
						
					
				
				
					commit
					1a27a15452
				
			
							
								
								
									
										17
									
								
								tree-diff.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								tree-diff.c
									
									
									
									
									
								
							@ -15,18 +15,13 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
static int tree_entry_pathcmp(struct tree_desc *t1, struct tree_desc *t2)
 | 
					static int tree_entry_pathcmp(struct tree_desc *t1, struct tree_desc *t2)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	unsigned mode1, mode2;
 | 
						struct name_entry *e1, *e2;
 | 
				
			||||||
	const char *path1, *path2;
 | 
						int cmp;
 | 
				
			||||||
	const unsigned char *sha1, *sha2;
 | 
					 | 
				
			||||||
	int cmp, pathlen1, pathlen2;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sha1 = tree_entry_extract(t1, &path1, &mode1);
 | 
						e1 = &t1->entry;
 | 
				
			||||||
	sha2 = tree_entry_extract(t2, &path2, &mode2);
 | 
						e2 = &t2->entry;
 | 
				
			||||||
 | 
						cmp = base_name_compare(e1->path, tree_entry_len(e1), e1->mode,
 | 
				
			||||||
	pathlen1 = tree_entry_len(&t1->entry);
 | 
									e2->path, tree_entry_len(e2), e2->mode);
 | 
				
			||||||
	pathlen2 = tree_entry_len(&t2->entry);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	cmp = base_name_compare(path1, pathlen1, mode1, path2, pathlen2, mode2);
 | 
					 | 
				
			||||||
	return cmp;
 | 
						return cmp;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user