Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 596b121

Browse files
committed
fix missing file and bad prototype
1 parent 114f5a6 commit 596b121

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

src/array.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
#ifndef INCLUDE_array_h__
8+
#define INCLUDE_array_h__
9+
10+
#include "util.h"
11+
12+
#define git_array_t(type) struct { type *ptr; size_t size, asize; }
13+
14+
#define git_array_init(a) \
15+
do { (a).size = (a).asize = 0; (a).ptr = NULL; } while (0)
16+
17+
#define git_array_clear(a) \
18+
do { git__free((a).ptr); git_array_init(a); } while (0)
19+
20+
#define git_array_grow(a) do { \
21+
void *new_array; size_t new_size = \
22+
((a).asize >= 256) ? (a).asize + 256 : ((a).asize >= 8) ? (a).asize * 2 : 8; \
23+
new_array = git__realloc((a).ptr, new_size * sizeof(*(a).ptr)); \
24+
if (!new_array) { git_array_clear(a); } \
25+
else { (a).ptr = new_array; (a).asize = new_size; } \
26+
} while (0)
27+
28+
#define GITERR_CHECK_ARRAY(a) GITERR_CHECK_ALLOC((a).ptr)
29+
30+
#define git_array_alloc(a, el) do { \
31+
if ((a).size >= (a).asize) git_array_grow(a); \
32+
(el) = (a).ptr ? &(a).ptr[(a).size++] : NULL; \
33+
} while (0)
34+
35+
#define git_array_last(a) ((a).size ? &(a).ptr[(a).size - 1] : NULL)
36+
37+
#define git_array_get(a, i) (((i) < (a).size) ? &(a).ptr[(i)] : NULL)
38+
39+
#define git_array_size(a) (a).size
40+
41+
#endif

src/diff_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
typedef struct git_diff_driver_registry git_diff_driver_registry;
1313

14-
git_diff_driver_registry *git_diff_driver_registry_new();
14+
git_diff_driver_registry *git_diff_driver_registry_new(void);
1515
void git_diff_driver_registry_free(git_diff_driver_registry *);
1616

1717
typedef struct git_diff_driver git_diff_driver;

0 commit comments

Comments
 (0)