summaryrefslogtreecommitdiff
path: root/src/pqueue.c
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-04-23 17:28:11 -0700
committerVicent Martí <tanoku@gmail.com>2012-04-23 17:28:11 -0700
commitf9f2344bd4ba6c81a96959509ba59f8563b60265 (patch)
treebb429dc1d066d433ab39076d3369cde56a48bc83 /src/pqueue.c
parent4795807ad5b4827ff4bdb801641ce8a4d5a8557e (diff)
parent26515e73a11b6f6c25e316ece2a6243aba7af9f5 (diff)
downloadlibgit2-f9f2344bd4ba6c81a96959509ba59f8563b60265.tar.gz
Merge pull request #632 from arrbee/win64-cleanup
Code clean up, including fixing warnings on Windows 64-bit build
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;
}