MINOR: buffer: replace buffer_empty() with b_empty() or c_empty()
For the same consistency reasons, let's use b_empty() at the few places
where an empty buffer is expected, or c_empty() if it's done on a channel.
Some of these places were there to realign the buffer so
{b,c}_realign_if_empty() was used instead.
diff --git a/include/common/buffer.h b/include/common/buffer.h
index e0b6c96..a05d58d 100644
--- a/include/common/buffer.h
+++ b/include/common/buffer.h
@@ -61,12 +61,6 @@
/***** FIXME: OLD API BELOW *****/
-/* Return non-zero only if the buffer is empty */
-static inline int buffer_empty(const struct buffer *buf)
-{
- return !b_data(buf);
-}
-
/* Returns non-zero if the buffer's INPUT is considered full, which means that
* it holds at least as much INPUT data as (size - reserve). This also means
* that data that are scheduled for output are considered as potential free
diff --git a/include/proto/channel.h b/include/proto/channel.h
index 026574f..850f900 100644
--- a/include/proto/channel.h
+++ b/include/proto/channel.h
@@ -685,7 +685,7 @@
* to wake up as many streams/applets as possible. */
static inline void channel_release_buffer(struct channel *chn, struct buffer_wait *wait)
{
- if (chn->buf->size && buffer_empty(chn->buf)) {
+ if (c_size(chn) && c_empty(chn)) {
b_free(&chn->buf);
offer_buffers(wait->target, tasks_run_queue);
}
@@ -728,8 +728,7 @@
static inline void co_skip(struct channel *chn, int len)
{
b_del(chn->buf, len);
- if (buffer_empty(chn->buf))
- chn->buf->p = chn->buf->data;
+ c_realign_if_empty(chn);
/* notify that some data was written to the SI from the buffer */
chn->flags |= CF_WRITE_PARTIAL | CF_WRITE_EVENT;