Sha256: 322eef4b2dd9b1f78f25b59034491f3547353655d9fcc9b6fe5a1ab348cb1eca

Contents?: true

Size: 1.19 KB

Versions: 27

Compression:

Stored size: 1.19 KB

Contents

/*
 * 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 "common.h"

#include "git2/oid.h"

/**
 * Format a git_oid into a newly allocated c-string.
 *
 * The c-string is owned by the caller and needs to be manually freed.
 *
 * @param id the oid structure to format
 * @return the c-string; NULL if memory is exhausted. Caller must
 *			deallocate the string with git__free().
 */
char *git_oid_allocfmt(const git_oid *id);

GIT_INLINE(int) git_oid__hashcmp(const unsigned char *sha1, const unsigned char *sha2)
{
	return memcmp(sha1, sha2, GIT_OID_RAWSZ);
}

/*
 * 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)
{
	return git_oid__hashcmp(a->id, b->id);
}

GIT_INLINE(void) git_oid__cpy_prefix(
	git_oid *out, const git_oid *id, size_t len)
{
	memcpy(&out->id, id->id, (len + 1) / 2);

	if (len & 1)
		out->id[len / 2] &= 0xF0;
}

#endif

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
rugged-1.3.2.3 vendor/libgit2/src/oid.h
rugged-1.3.2.1 vendor/libgit2/src/oid.h
rugged-1.3.2 vendor/libgit2/src/oid.h
rugged-1.3.1 vendor/libgit2/src/oid.h
rugged-1.3.0 vendor/libgit2/src/oid.h
rugged-1.2.0 vendor/libgit2/src/oid.h
rugged-1.1.1 vendor/libgit2/src/oid.h
rugged-1.1.0 vendor/libgit2/src/oid.h
rugged-1.0.1 vendor/libgit2/src/oid.h
rugged-0.28.5 vendor/libgit2/src/oid.h
rugged-1.0.0 vendor/libgit2/src/oid.h
rugged-0.99.0 vendor/libgit2/src/oid.h
rugged-0.27.10.1 vendor/libgit2/src/oid.h
rugged-0.28.4.1 vendor/libgit2/src/oid.h
rugged-0.28.4 vendor/libgit2/src/oid.h
rugged-0.27.10 vendor/libgit2/src/oid.h
rugged-0.28.3.1 vendor/libgit2/src/oid.h
rugged-0.27.9 vendor/libgit2/src/oid.h
rugged-0.28.2 vendor/libgit2/src/oid.h
rugged-0.28.1 vendor/libgit2/src/oid.h