From: Jan Kiszka <jan.kiszka@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] Re: [patch] static buffer for timer-bheap
Date: Fri, 02 Jun 2006 18:07:47 +0200 [thread overview]
Message-ID: <44806253.9020805@domain.hid> (raw)
In-Reply-To: <17536.21805.408809.703077@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 1474 bytes --]
Gilles Chanteperdrix wrote:
> 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.
But I also did not use the macro, which avoids such mistakes now.
> 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
> destruction.
Ok, we could make bheap_destroy pop up under XENO_OPT_DEBUG. We may then
also add assertions to the bheap functions themselves to check for
invalid usage.
>
> It is a low price to pay to make the interface a bit safer.
>
The price is also larger code in every heap runtime function due to the
additional indirection. I still vote for the combined structure and to
give its allocation completely in user hand.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next prev parent reply other threads:[~2006-06-02 16:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-01 23:05 [Xenomai-core] [patch] static buffer for timer-bheap Jan Kiszka
2006-06-02 11:59 ` [Xenomai-core] " Gilles Chanteperdrix
2006-06-02 12:18 ` Jan Kiszka
2006-06-02 13:34 ` Gilles Chanteperdrix
2006-06-02 14:18 ` Gilles Chanteperdrix
2006-06-02 14:55 ` Jan Kiszka
2006-06-02 15:11 ` Gilles Chanteperdrix
2006-06-02 16:07 ` Jan Kiszka [this message]
2006-06-02 16:24 ` Gilles Chanteperdrix
2006-06-02 16:58 ` Jan Kiszka
2006-06-02 18:39 ` Jan Kiszka
2006-06-03 15:38 ` Gilles Chanteperdrix
2006-06-03 17:20 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44806253.9020805@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.