File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -93,17 +93,23 @@ int git_pqueue_insert(git_pqueue *pq, void *item)
9393 (void )git_pqueue_pop (pq );
9494 }
9595
96- if (!(error = git_vector_insert (pq , item )))
96+ if (!(error = git_vector_insert (pq , item )) && pq -> _cmp )
9797 pqueue_up (pq , pq -> length - 1 );
9898
9999 return error ;
100100}
101101
102102void * git_pqueue_pop (git_pqueue * pq )
103103{
104- void * rval = git_pqueue_get ( pq , 0 ) ;
104+ void * rval ;
105105
106- if (git_pqueue_size (pq ) > 1 ) {
106+ if (!pq -> _cmp ) {
107+ rval = git_vector_last (pq );
108+ } else {
109+ rval = git_pqueue_get (pq , 0 );
110+ }
111+
112+ if (git_pqueue_size (pq ) > 1 && pq -> _cmp ) {
107113 /* move last item to top of heap, shrink, and push item down */
108114 pq -> contents [0 ] = git_vector_last (pq );
109115 git_vector_pop (pq );
You can’t perform that action at this time.
0 commit comments