DOC: buffers: clarify the purpose of the <from> pointer in offer_buffers()

This one is only used to compare pointers and NULL is permitted though
this is far from being clear.
This commit is contained in:
Willy Tarreau 2018-03-02 10:27:12 +01:00
parent ec9516a6dc
commit c41b3e8dff
2 changed files with 8 additions and 0 deletions

View File

@ -769,6 +769,13 @@ static inline struct buffer *b_alloc_margin(struct buffer **buf, int margin)
}
/* Offer a buffer currently belonging to target <from> to whoever needs one.
* Any pointer is valid for <from>, including NULL. Its purpose is to avoid
* passing a buffer to oneself in case of failed allocations (e.g. need two
* buffers, get one, fail, release it and wake up self again). In case of
* normal buffer release where it is expected that the caller is not waiting
* for a buffer, NULL is fine.
*/
void __offer_buffer(void *from, unsigned int threshold);
static inline void offer_buffers(void *from, unsigned int threshold)

View File

@ -247,6 +247,7 @@ void buffer_dump(FILE *o, struct buffer *b, int from, int to)
fflush(o);
}
/* see offer_buffer() for details */
void __offer_buffer(void *from, unsigned int threshold)
{
struct buffer_wait *wait, *bak;