diff --git a/include/common/buf.h b/include/common/buf.h index 6d1a8c0be..564e0ebad 100644 --- a/include/common/buf.h +++ b/include/common/buf.h @@ -322,6 +322,13 @@ static inline void b_set_data(struct buffer *b, size_t len) } } +/* b_realign_if_empty() : realigns a buffer if it's empty */ +static inline void b_realign_if_empty(struct buffer *b) +{ + if (!b_data(b)) + b->p = b->data; +} + #endif /* _COMMON_BUF_H */