MINOR: buffer: merge b{i,o}_contig_space()
These ones were merged into a single b_contig_space() that covers both
(the bo_ case was a simplified version of the other one). The function
doesn't use ->i nor ->o anymore.
diff --git a/include/common/buf.h b/include/common/buf.h
index 0ee9c54..33830f7 100644
--- a/include/common/buf.h
+++ b/include/common/buf.h
@@ -293,6 +293,24 @@
return data;
}
+/* b_contig_space() : returns the amount of bytes that can be appended to the
+ * buffer at once.
+ */
+static inline size_t b_contig_space(const struct buffer *b)
+{
+ const char *left, *right;
+
+ right = b_head(b);
+ left = right + b_data(b);
+
+ if (left >= b_wrap(b))
+ left -= b_size(b);
+ else
+ right = b_wrap(b);
+
+ return right - left;
+}
+
/*********************************************/
/* Functions used to modify the buffer state */