Add isc_buffer_trycompact() that's an optimization; it will compact the
buffer only when the remaining length is smaller than used length.
*
*/
+static inline void
+isc_buffer_trycompact(isc_buffer_t *b);
static inline void
isc_buffer_compact(isc_buffer_t *b);
/*!<
b->length = length;
}
+static inline void
+isc_buffer_trycompact(isc_buffer_t *b) {
+ if (isc_buffer_consumedlength(b) >= isc_buffer_remaininglength(b)) {
+ isc_buffer_compact(b);
+ }
+}
+
static inline void
isc_buffer_compact(isc_buffer_t *b) {
unsigned int length;