Debian Codegraph @

src/util/allocators/stdalloc.c

raw
1 /*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7
8 #include "stdalloc.h"
9
10 static void *stdalloc__malloc(size_t len, const char *file, int line)
11 {
12 GIT_UNUSED(file);
13 GIT_UNUSED(line);
14
15 return malloc(len);
16 }
17
18 static void *stdalloc__realloc(void *ptr, size_t size, const char *file, int line)
19 {
20 GIT_UNUSED(file);
21 GIT_UNUSED(line);
22
23 return realloc(ptr, size);
24 }
25
26 static void stdalloc__free(void *ptr)
27 {
28 free(ptr);
29 }
30
31 int git_stdalloc_init_allocator(git_allocator *allocator)
32 {
33 allocator->gmalloc = stdalloc__malloc;
34 allocator->grealloc = stdalloc__realloc;
35 allocator->gfree = stdalloc__free;
36 return 0;
37 }