summaryrefslogtreecommitdiff
path: root/src/pqueue.c
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-05-05 14:22:53 -0700
committerVicent Martí <tanoku@gmail.com>2012-05-05 14:22:53 -0700
commit48ecd122ea6fb8cf12fb4029974c314e5d9efb62 (patch)
tree88f90fa8c9d903f072a2b1c647c51a9899e520c7 /src/pqueue.c
parent2218fd57a50ceb851cb131939bf0747e072e40f6 (diff)
parent4ef14af93517b3842bc0dfa24147cf10dd029582 (diff)
downloadlibgit2-48ecd122ea6fb8cf12fb4029974c314e5d9efb62.tar.gz
Merge pull request #659 from libgit2/development-merge
New-error-handling
Diffstat (limited to 'src/pqueue.c')
-rw-r--r--src/pqueue.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pqueue.c b/src/pqueue.c
index 3fbf93315..cb59c13ec 100644
--- a/src/pqueue.c
+++ b/src/pqueue.c
@@ -17,14 +17,14 @@ int git_pqueue_init(git_pqueue *q, size_t n, git_pqueue_cmp cmppri)
assert(q);
/* Need to allocate n+1 elements since element 0 isn't used. */
- if ((q->d = git__malloc((n + 1) * sizeof(void *))) == NULL)
- return GIT_ENOMEM;
+ q->d = git__malloc((n + 1) * sizeof(void *));
+ GITERR_CHECK_ALLOC(q->d);
q->size = 1;
q->avail = q->step = (n + 1); /* see comment above about n+1 */
q->cmppri = cmppri;
- return GIT_SUCCESS;
+ return 0;
}
@@ -102,8 +102,8 @@ int git_pqueue_insert(git_pqueue *q, void *d)
/* allocate more memory if necessary */
if (q->size >= q->avail) {
newsize = q->size + q->step;
- if ((tmp = git__realloc(q->d, sizeof(void *) * newsize)) == NULL)
- return GIT_ENOMEM;
+ tmp = git__realloc(q->d, sizeof(void *) * newsize);
+ GITERR_CHECK_ALLOC(tmp);
q->d = tmp;
q->avail = newsize;
@@ -114,7 +114,7 @@ int git_pqueue_insert(git_pqueue *q, void *d)
q->d[i] = d;
bubble_up(q, i);
- return GIT_SUCCESS;
+ return 0;
}