On Saturday 2014-10-04 00:45, Peter Stuge wrote:
Why did you add the talloc.h include?
- Because the file calls talloc_free().
Why is talloc_free() called?
- To free memory allocated and returned by osmo_config_list_parse().
Symmetry then dictates that the talloc.h include belongs in msgfile.h,
as opposed to in all files which includes msgfile.h.
Certainly. I even concur with the symmetry argument,
though I feel you have missed one point:
Symmetry would desire that there be a osmo_config_list_free()
function (or macro/static inline function), because the allocation
method of "struct osmo_config_list" would be an implementation detail
of osmo_config_list_parse().
I really hope that makes sense. Headers usually do
include their
dependencies, rather than require callers to do that on their own.
As of yet though, talloc is not a "direct" dependency of msgfile.h,
that is, there are no names used from talloc.h and
`gcc -x c msgfile.h` will succeed.
With a osmo_config_list_free() function/macro/SI,
the talloc #include would always be at the callsite too,
though the callsite is shifted.