Jan Kiszka wrote:
 > Gilles Chanteperdrix wrote:
 > > I would also prefer passing the bheaph_t** storage to bheap_init, and
 > > conserve bheap_destroy (with a callback called with the bheap_t**
 > > storage) in case the storage was dynamically allocated by the caller.
 > Do you have a concrete usage scenario in mind where this would be
 > required? I would rather bet that potential callers of bheap_destroy
 > know very well when some buffer is to be released. Looks at bit like
 > overkill unless someone has the real need to mix dynamically with
 > statically allocated bheaps.

Requesting a bheaph_t ** to be passed to bheap_init is type-safe and
would have caught the kind of mistake you have done. bheap_destroy allow
setting the bheap_t structure to an invalid value which, in turn, allow
helping upper layers in catching invalid uses of the bheap after its

It is a low price to pay to make the interface a bit safer.


                                            Gilles Chanteperdrix.

Xenomai-core mailing list

Reply via email to