Skip to content

Commit 0611aea

Browse files
committed
queue: New function queue_is_empty().
1 parent 0742399 commit 0611aea

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/queue.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef QUEUE_H
1818
#define QUEUE_H 1
1919

20+
#include <stdbool.h>
21+
2022
/* Packet queue. */
2123
struct ovs_queue {
2224
int n; /* Number of queued packets. */
@@ -31,4 +33,9 @@ void queue_advance_head(struct ovs_queue *, struct ofpbuf *next);
3133
void queue_push_tail(struct ovs_queue *, struct ofpbuf *);
3234
struct ofpbuf *queue_pop_head(struct ovs_queue *);
3335

36+
static inline bool queue_is_empty(const struct ovs_queue *q)
37+
{
38+
return q->n == 0;
39+
}
40+
3441
#endif /* queue.h */

0 commit comments

Comments
 (0)