Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
d4975464
Commit
d4975464
authored
Sep 13, 2013
by
Rusty Russell
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of ozlabs.org:ccan
parents
75ce5f11
03d339d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
ccan/heap/heap.h
ccan/heap/heap.h
+10
-2
No files found.
ccan/heap/heap.h
View file @
d4975464
...
...
@@ -88,7 +88,8 @@ int heap_push(struct heap *h, void *data);
*
* Returns the root entry of the heap after extracting it, or NULL on error.
*
* Note: Calling heap_pop() on an empty heap is a bug--don't do it.
* Note: Calling heap_pop() on an empty heap is a bug. When in doubt,
* check heap->len. See heap_peek()'s documentation for an example.
*
* Complexity: O(log n)
*
...
...
@@ -102,9 +103,16 @@ void *heap_pop(struct heap *h);
*
* Returns the root entry in the heap, without extracting it from @h.
*
* Note: Calling heap_peek() on an empty heap is a bug--don't do it.
* Note: Calling heap_peek() on an empty heap is a bug; check the heap's
* number of items and act accordingly, as in the example below.
*
* See also: heap_pop()
*
* Example:
* static inline void *heap_peek_safe(const struct heap *h)
* {
* return h->len ? heap_peek(h) : NULL;
* }
*/
static
inline
void
*
heap_peek
(
const
struct
heap
*
h
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment