Sha256: 0897973a8dd43caeedf3806771930d163db62554af8efc61b1c536e7daeb4052

Contents?: true

Size: 1.61 KB

Versions: 30

Compression:

Stored size: 1.61 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_alloc_h__
#define INCLUDE_alloc_h__

#include "git2/sys/alloc.h"

extern git_allocator git__allocator;

#define git__malloc(len)                      git__allocator.gmalloc(len, __FILE__, __LINE__)
#define git__calloc(nelem, elsize)            git__allocator.gcalloc(nelem, elsize, __FILE__, __LINE__)
#define git__strdup(str)                      git__allocator.gstrdup(str, __FILE__, __LINE__)
#define git__strndup(str, n)                  git__allocator.gstrndup(str, n, __FILE__, __LINE__)
#define git__substrdup(str, n)                git__allocator.gsubstrdup(str, n, __FILE__, __LINE__)
#define git__realloc(ptr, size)               git__allocator.grealloc(ptr, size, __FILE__, __LINE__)
#define git__reallocarray(ptr, nelem, elsize) git__allocator.greallocarray(ptr, nelem, elsize, __FILE__, __LINE__)
#define git__mallocarray(nelem, elsize)       git__allocator.gmallocarray(nelem, elsize, __FILE__, __LINE__)
#define git__free                             git__allocator.gfree

/**
 * This function is being called by our global setup routines to
 * initialize the standard allocator.
 */
int git_allocator_global_init(void);

/**
 * Switch out libgit2's global memory allocator
 *
 * @param allocator The new allocator that should be used. All function pointers
 *                  of it need to be set correctly.
 * @return An error code or 0.
 */
int git_allocator_setup(git_allocator *allocator);

#endif

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rugged-1.6.5 vendor/libgit2/src/util/alloc.h
rugged-1.6.3 vendor/libgit2/src/util/alloc.h
rugged-1.6.2 vendor/libgit2/src/util/alloc.h
rugged-1.5.1 vendor/libgit2/src/util/alloc.h
rugged-1.4.5 vendor/libgit2/src/alloc.h
rugged-1.5.0.1 vendor/libgit2/src/util/alloc.h
rugged-1.5.0 vendor/libgit2/src/util/alloc.h
rugged-1.3.2.3 vendor/libgit2/src/alloc.h
rugged-1.4.4 vendor/libgit2/src/alloc.h
rugged-1.3.2.1 vendor/libgit2/src/alloc.h
rugged-1.4.3 vendor/libgit2/src/alloc.h
rugged-1.3.2 vendor/libgit2/src/alloc.h
rugged-1.4.2 vendor/libgit2/src/alloc.h
rugged-1.3.1 vendor/libgit2/src/alloc.h
rugged-1.3.0 vendor/libgit2/src/alloc.h
rugged-1.2.0 vendor/libgit2/src/alloc.h
rugged-1.1.1 vendor/libgit2/src/alloc.h
rugged-1.1.0 vendor/libgit2/src/alloc.h
rugged-1.0.1 vendor/libgit2/src/alloc.h
rugged-0.28.5 vendor/libgit2/src/alloc.h