mirror of
				https://git.proxmox.com/git/libgit2
				synced 2025-11-04 14:08:17 +00:00 
			
		
		
		
	Add new src/oid.h
This commit is contained in:
		
							parent
							
								
									d77611022c
								
							
						
					
					
						commit
						e4af0f0016
					
				
							
								
								
									
										33
									
								
								src/oid.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/oid.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,33 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) the libgit2 contributors. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 | 
			
		||||
 * a Linking Exception. For full terms see the included COPYING file.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef INCLUDE_oid_h__
 | 
			
		||||
#define INCLUDE_oid_h__
 | 
			
		||||
 | 
			
		||||
#include "git2/oid.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Compare two oid structures.
 | 
			
		||||
 *
 | 
			
		||||
 * @param a first oid structure.
 | 
			
		||||
 * @param b second oid structure.
 | 
			
		||||
 * @return <0, 0, >0 if a < b, a == b, a > b.
 | 
			
		||||
 */
 | 
			
		||||
GIT_INLINE(int) git_oid__cmp(const git_oid *a, const git_oid *b)
 | 
			
		||||
{
 | 
			
		||||
	const unsigned char *sha1 = a->id;
 | 
			
		||||
	const unsigned char *sha2 = b->id;
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < GIT_OID_RAWSZ; i++, sha1++, sha2++) {
 | 
			
		||||
		if (*sha1 != *sha2)
 | 
			
		||||
			return *sha1 - *sha2;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user