Sha256: fa581a2ecd732f0e8d23cd2fd721e41918c7608ad6b26ed0e08f11ae00632d4c

Contents?: true

Size: 904 Bytes

Versions: 2

Compression:

Stored size: 904 Bytes

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.
 */

#include "stdalloc.h"

static void *stdalloc__malloc(size_t len, const char *file, int line)
{
	GIT_UNUSED(file);
	GIT_UNUSED(line);

#ifdef GIT_DEBUG_STRICT_ALLOC
	if (!len)
		return NULL;
#endif

	return malloc(len);
}

static void *stdalloc__realloc(void *ptr, size_t size, const char *file, int line)
{
	GIT_UNUSED(file);
	GIT_UNUSED(line);

#ifdef GIT_DEBUG_STRICT_ALLOC
	if (!size)
		return NULL;
#endif

	return realloc(ptr, size);
}

static void stdalloc__free(void *ptr)
{
	free(ptr);
}

int git_stdalloc_init_allocator(git_allocator *allocator)
{
	allocator->gmalloc = stdalloc__malloc;
	allocator->grealloc = stdalloc__realloc;
	allocator->gfree = stdalloc__free;
	return 0;
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rugged-1.7.2 vendor/libgit2/src/util/allocators/stdalloc.c
rugged-1.7.1 vendor/libgit2/src/util/allocators/stdalloc.c