[PATCH 2/3] build: allow using a system-provided talloc properly

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Peter Stuge peter at stuge.se
Fri Oct 3 22:45:43 UTC 2014


Jan Engelhardt wrote:
> 
> On Friday 2014-10-03 15:16, Peter Stuge wrote:
> 
> >> >> >* Firmware builds with no talloc
> >> >> That may be the use case, but it is not what was implemented.
> >> >Why don't you look into fixing that
> >> Why should I?
> >
> >Because you seem to be working with this part of the code now and you
> >might as well do a thorough job if you're spending time on it.
> 
> I am not going to

Okey then.


> >> >> >> +#include <osmocom/core/talloc.h>
> >> >> >
> >> >> >Is this hunk needed?
> >> >> Yes, because system talloc has a
> >> >> #define talloc_free(ctx) _talloc_free(ctx, __location__)
> >> >> and otherwise, one gets "implicit definition of talloc_free" and
> >> >> "undefined reference to `talloc_free'".
> >> >
> >> >Dude, that is a kludge at a callsite, as opposed to a proper
> >> >dependency fix. Try again.
> >
> >Here's a hint at least: Think about symmetry and dependency.
> 
> I have no idea what you mean by that.

That's sad.. :\

> Talk code, not riddles.
> Other code also uses #include <osmocore/core/talloc.h>,
> so it does not seem too far-fetched to use the exact line
> to support the case of multiple talloc configurations.

Think more about it.

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.

I really hope that makes sense. Headers usually do include their
dependencies, rather than require callers to do that on their own.


//Peter




More information about the OpenBSC mailing list