summaryrefslogtreecommitdiff
path: root/src/array.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-08-17 07:58:55 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-09-06 19:56:51 +0200
commitfb23d05f0bc3084cdb5a9737b1c678817c5bc9e8 (patch)
tree3d9851a8a2f823dbd12cf7dbd97469d3c64d0567 /src/array.h
parent51a5e13347a0f834e2d847b46d2f6002f03bd49f (diff)
downloadlibgit2-fb23d05f0bc3084cdb5a9737b1c678817c5bc9e8.tar.gz
revwalk: make mark_unintersting use a loop
Using a recursive function can blow the stack when dealing with long histories. Use a loop instead to limit the call chain depth. This fixes #1223.
Diffstat (limited to 'src/array.h')
-rw-r--r--src/array.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/array.h b/src/array.h
index c25a1b29e..b82079bd8 100644
--- a/src/array.h
+++ b/src/array.h
@@ -63,6 +63,8 @@ GIT_INLINE(void *) git_array_grow(void *_a, size_t item_size)
#define git_array_last(a) ((a).size ? &(a).ptr[(a).size - 1] : NULL)
+#define git_array_pop(a) ((a).size ? &(a).ptr[--(a).size] : NULL)
+
#define git_array_get(a, i) (((i) < (a).size) ? &(a).ptr[(i)] : NULL)
#define git_array_size(a) (a).size