MINOR: sample: add a new helper to initialize the owner of a sample
authorWilly Tarreau <w@1wt.eu>
Thu, 10 Mar 2016 15:15:46 +0000 (16:15 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 10 Mar 2016 15:42:58 +0000 (16:42 +0100)
commit1777ea63e0b7375b51511bbc4a9c9f88f0f89171
tree8938859adae8268a09477317883dd897d4ec57ab
parentbe508f158077cab6ed65581cd0e66d5908cf61da
MINOR: sample: add a new helper to initialize the owner of a sample

Since commit 6879ad3 ("MEDIUM: sample: fill the struct sample with the
session, proxy and stream pointers") merged in 1.6-dev2, the sample
contains the pointer to the stream and sample fetch functions as well
as converters use it heavily. This requires from a lot of call places
to initialize 4 fields, and it was even forgotten at a few places.

This patch provides a convenient helper to initialize all these fields
at once, making it easy to prepare a new sample from a previous one for
example.

A few call places were cleaned up to make use of it. It will be needed
by further fixes.

At one place in the Lua code, it was moved earlier because we used to
call sample casts with a non completely initialized sample, which is
not clean eventhough at the moment there are no consequences.
include/proto/sample.h
src/hlua.c
src/sample.c